This is first article from next few I will write about LAMP.
I will not write about what LAMP is, I guess that you already know since you are reading how to install it.
So, to install LAMP in Linux CentOS, follow next steps:
First, make sure that your system is up to date:
# yum update -y
Once update is finished, you need to install Apache:
# yum install httpd -y
After installation, you need to add apache service to system startup:
# chkconfig --levels 235 httpd on
and then start it up:
# service httpd start
Now, open your browser and go to localhost, or http://yourdomain.tld and you should see Apache default page.
Next step is to install PHP as an Apache module (mod_php). Do it like this:
# yum install php -y
After you install it, you have to check is everything’s fine. You need to create an PHP info page, and put it in Apache root ( /var/www/html ), so you can check that PHP support is enabled:
# echo -e "<?php\n\tphpinfo();\n?>" > /var/www/html/info.php
Once you created info.php file, you need to reload Apache, so installed PHP module can take effect:
# service httpd restart
Now you need to open this file with your browser. Go to http://yourdomain.tld/info.php and you should see a page with some PHP info.
Now you need to install MySQL support. This mean that you have to install PHP module for MySQL. Beside this, it’s good to install and module for PHP console and PHP common files:
# yum install php-cli php-common php-gd php-mysql -y
Again, restart Apache:
# service httpd restart
After all this, now you need to install the last main component of LAMP stack – MySQL server. Do it like this:
# yum install mysql mysql-server -y
and then add to system startup, and run the service:
# chkconfig --levels 235 mysqld on
# service mysqld start
Once it is started, it’s good that you set MySQL root password. Also, it’s recommended to disable remote root login if you don’t really need it. It’s good that you remove anonymous users and remote ‘test’ database right away as well. All this you can do with:
# mysql_secure_installation
After this, your installation of LAMP is finished. Of course, there is more stuff you should install, but this is the basic.
In next article, to this installation, we will add PhpMyAdmin, some cashe engine, and some more cool stuff.
If you liked the post, we should get connected - follow me on Twitter