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

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

Your server is ready to host and run websites.

Our Recommended VPS Hosting

1 Comment

  • hi..

    i got this error when try to install php php-mysql

    yum install php php-mysql
    Loaded plugins: replace
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package php.x86_64 0:5.3.3-27.el6_5 will be installed
    –> Processing Dependency: php-cli(x86-64) = 5.3.3-27.el6_5 for package: php-5.3.3-27.el6_5.x86_64
    –> Processing Dependency: php-common(x86-64) = 5.3.3-27.el6_5 for package: php-5.3.3-27.el6_5.x86_64
    —> Package php-mysql.x86_64 0:5.3.3-27.el6_5 will be installed
    –> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-27.el6_5.x86_64
    –> Running transaction check
    —> Package php-cli.x86_64 0:5.3.3-27.el6_5 will be installed
    —> Package php-common.x86_64 0:5.3.3-27.el6_5 will be installed
    —> Package php-pdo.x86_64 0:5.3.3-27.el6_5 will be installed
    –> Processing Conflict: php55w-common-5.5.12-1.w6.x86_64 conflicts php-common Finished Dependency Resolution
    Error: php55w-common conflicts with php-common-5.3.3-27.el6_5.x86_64
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

Leave us a Reply

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

* *