How to Install LAMP (Linux, Apache, MySQL, PHP) on CentOS RedHat 6 Server

In this tutorial I will explain how to install and setup LAMP on a RHEL/CentOS Linux 6.x server.
Before I start the tutorial, let’s know what is LAMP. LAMP stack is a group of open source software used to get web servers up and running. LAMP stands for Linux, Apache, MySQL, and PHP.

Installation Procedure

  1. Install Linux
  2. Install Apache
  3. Install MySQL
  4. Install PHP

Install Linux

Your VPS / dedicated server comes with pre-installed Linux OS. You can select your linux OS during order process. So, we do not need to install Linux. Select CentOS 6 Linux OS during order process.

Install Apache

Login to your server via SSH as root and run following commands

yum install httpd
service httpd start

A more detailed tutorial is here: How to install Apache on a Linux Server

Install MySQL

Run below commands to install MySQL

yum install mysql-server
service mysqld start
/usr/bin/mysql_secure_installation

MySQL server will ask MySQL server root password. Since you just installed mysql, there is no MySQL root password. So, just press enter. Create MySQL root password and complete the installation.

Please refer here for complete step by step installation: How To Install MySQL on a CentOS Server

Install PHP

After installing Apache and MySQL, we will install PHP. Run following commands

yum install php php-mysql
service httpd restart

A more detailed tutorial for installing PHP is here: How To Install PHP on a CentOS server

Done!!!
Your server is ready to host and run websites.

Our Top Rated Host

Related Posts