Install LAMP server in CentOS 6.4

LAMP is a acronym for Linux, Apache, MySQL and PHP. In this very first tutorial on my blog, I will walk through the steps on how to install LAMP server in CentOS 6.4.
For the sake of installation information, and to rule out any configuration/hardware mix-up’s, here is the quick high level details of my test machine. Keep in mind, this is specific to my installation, and you may need to make some adjustments depending on how you are setting up your test environment. With that in mind, consider yourselves informed!

  • My test machine is a Virtual Machine, running on VMware Workstation v9.0.0
  • I have installed the VM with the following settings:


  •  My testbox hostname is:  snoopy.localdomain.vm

I’m also assuming that you have atleast completed the basic installation of CentOS. I know.. I should have done that tutorial first, shame on me. I promise I’ll do another tutorial on installing CentOS. In the meanwhile, there are plenty of alternative sites that go through the basic installation of Linux.

NOTE – Some of these packages may in-fact already be installed. If they are, GREAT!

Install Apache

Start apache and set it to start automatically on every reboot.

Test Apache

Open your Browser and Enter the IP address for your machine “″. You will see the Apache splash page.


Install MySQL

Start MySQL and set it to start automatically on every reboot.

Once it is done installing, you can set a root MySQL password:

The prompt will ask you for your current root password.
Since you just installed MySQL, you won’t have one, so leave it blank by pressing enter.

Then the prompt will ask you if you want to set a root password. Go ahead and choose Y and follow the instructions.

CentOS automates the process of setting up MySQL, asking you a series of yes or no questions.

It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.

Install PHP

Restart Apache server

Test PHP

Create a test php page, and save it to the /var/www/html directory

< ?php phpinfo(); ? > <-- (Make sure you fix the tags)

Now open the testphp.php file in browser using If everything is done correctly, it will display the details about your php configuration. If not, go back and check your steps, and insure you didn’t miss any steps.

At this point you might want to add a few other modules that will be helpful for your coding. And don’t hurt to have installed.

You might want add APC too – APC is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It’s similar to other PHP opcode cachers, such as eAccelerator and Xcache. It is strongly recommended to have one of these installed to speed up your PHP page.

And restart Apache..

NOTE – Additional php modules can be located by performing a search.

Install phpMyAdmin

phpMyAdmin is a free open source web tool, used to manage your MySQL databases. By default phpMyAdmin is not found in CentOS official repositories; however it is available in the EPEL repository. EPEL stands for Extra Packages for Enterprise Linux.

At the time I wrote this, 6-8 was the latest version.

Now you can install phpMyAdmin

Configure phpMyAdmin

Open the phpmyadmin.conf file and make the following changes.

If you want to access phpMyAdmin from anywhere other then the localhost, then comment the following lines, just below the beginning of the file.

Copy the config sample file and change the authentication method from “cookie” to “http”.

Restart the Apache service

Now you should be able to access the phpmyadmin console using http://ipaddress or http://domainname/phpmyadmin/. Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “password”. Shh, don’t tell anyone.. 😉


Which leads too..

Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *