Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6

LAMP stack is a group of open source softwares used to get web servers up and running. This guide assumes that you already have your CentOS installed successfully.

1. Install Apache

Apache is the web server in the lamp stack.

Install apache command

Start apache on your server

(Optional) Test if apache is alive

Get your IP address first

Then open the following url in your web browser

2. Install MySQL

MySQL is the database management system used in LAMP stack.

Install MySQL command

Start MySQL service

Set a root MySQL password

This will prompt you for your current MySQL root password, which you will most likely have none, because you have just installed MySQL only. So just leave it blank by pressing enter.

Next a series of yes/no questions will appear. All you have to do is just say Yes to all the options.

3. Install PHP

Install PHP command

(Optional) Install additional php modules

Search for PHP modules command

Next a bunch of php modules with their description will appear. So just use yum to install which ever modules that you want.

4. Configure Apache and MySQL to run on boot

5. Test if PHP is working on your server

By default apache web root directory is at /var/www/html

Create a file called info.php 

(Optional) If nano is not installed yet

Add the following code to info.php

Then save and exit

Restart Apache and visit the url on your web browser as follows

Then you should see your server’s php information


Feel free to contact me at [email protected] if you have any further questions.

One thought on “Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6”

Leave a Reply

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

11 − 9 =