Installation of LAMP on centos 6.6

Install wget

$ sudo yum install wget

Install Apache

To install apache,

$ sudo yum install httpd

Once it installs, you can start apache running on your VPS:

$ sudo service httpd start
$ sudo chkconfig httpd on

Edit the #ServerName and put your hostname instead of in httpd.conf file

$ sudo vi /etc/httpd/conf/httpd.conf

Install MySQL 5.6

Download the yum repo rpm package.

$ wget

Install the downloaded rpm package.

$ rpm -ivh mysql-community-release-el6-5.noarch.rpm

Install the mysql server

$ yum install mysql-server

After installation start the mysql server

$ /etc/init.d/mysqld start
$ sudo chkconfig mysqld on

MySQL server is just installed it has blank mysql root password. To reset the mysql root password.

$ sudo mysql_secure_installation

Install PHP 5.6

Download the repo rpm package

$ sudo rpm -Uvh

Install the php with the required extension

$ sudo yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring

Restart Apache:

$ sudo service httpd restart

To verify that PHP 5.6 is installed:

$ php -v

For testing php test page

$ sudo vi /var/www/html/info.php

Add in the following line:


Then save it and restart apache.

$ sudo service httpd restart

PHP Modules

PHP also has a variety of useful libraries and modules that you can add onto your server. You can see the libraries that are available by typing:

$ sudo yum search php-

To see more details about what each module does, type the following command into terminal, replacing the name of the module with whatever library you want to learn about.

$ sudo yum info name of the module

Once you decide to install the module, type:

$ sudo yum install name of the module

You can install multiple libraries at once by separating the name of each module with a space.

Now LAMP stack is installed!

Allow port 80

$ sudo vi /etc/sysconfig/iptables

and add this line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Visit site at : http://ip-address