Install LAMP on CentOS 7

A LAMP (Linux, Apache, MySQL, PHP) stack is free, and open-source web stack. It is used for hosting web content in a Linux environment.Many consider this as the platform of choice for high performance web apps.

In this article, i will illustrate the LAMP setup process.


Upgrade centos to the latest release.

sudo yum update

Install Apache

Install apache 2.4 from centos repository.

sudo yum install httpd

Install Percona Server

Install latest version of Percona Server 5.7 using Percona repository.

yum install
yum install percona-server-server-5.7

Install Mongo

Install latest version of MongoDB 4.0 using MongoDB repository.

cat /etc/yum.repos.d/mongodb-org-4.0.repo
name=MongoDB Repository
yum install -y mongodb-org

Install PHP

Install PHP 7.1 and it’s libraries and restart Apache server. You should be able to see Apache default page.

yum install epel-release yum-utils -y
yum install
yum-config-manager --enable remi-php71
yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql php-mongodb php-pear -y

Troubleshoot & Test

Now, we have setup the lamp stack, it’s time to test it.

Let’s check the php info. Create the below file and you should be able to see the php info on browser.

# cat /var/www/html/phpinfo.php 
<?php phpinfo( ); ?>



It’s so easy to setup lamp stack. You have done it.

@@ Enjoy…

Leave a Reply

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