Installing LAMP stack on CentOS 6

LAMP or Linux, Apache, MySQL, and PHP is the default software stack most PHP+MySQL based applications use, it's the easiest and quickest way to get your PHP+MySQL application online. A LAMP stack can be installed on CentOS 6 with the following commands.

Updating the system

We first update the system to make sure that all our installed packages are upto date. Your CentOS 6 system can be updated easily with the following command,

yum update

Install Apache

Apache can be installed with the following command, usually Apache comes pre-installed on the default CentOS images we have but if your VPS has been installed with a minimal OS image, then it won't come with Apache pre-installed.

yum install httpd

Once the install finishes, start Apache with the following command,

service httpd start

Install PHP

Here we install PHP and the PHP-mysql plugin for PHP to communicate with your MySQL server.

yum install php php-mysql

Restart Apache so that Apache detects PHP and enables it,

service httpd restart

Install MySQL

MySQL can be installed with the following command,

yum install mysql-server

Setup MySQL with a root password

/usr/bin/mysql_secure_installation

Start MySQL once the above step is complete,

service mysqld start

Set Apache/MySQL services to start on boot

chkconfig httpd on
chkconfig mysqld on

Done! Load your VPSes IP address in the browser and it should display the default Apache page!

All your files to be displayed go into the default web-root at

/var/www/html

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS