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.

CentOS7

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 http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm
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
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
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 http://rpms.remirepo.net/enterprise/remi-release-7.rpm
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( ); ?>
#

phpinfo

Conclusion

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 *