How to install LAMP on CentOS 7

We’ll show you how to install LAMP on CentOS 7. LAMP is actually an acronym for a web services solution stack consisting of Linux, the Apache HTTP Server, the MySQL or MariaDB database engines, and the PHP, Perl or Python programming language. All components are free and open-source software, and the combination is suitable for building dynamic web pages.

Requirements?

We are using our SSD 1 VPS hosting plan for this set-up, which should be more than enough to run LAMP and host multiple dynamic websites using virtual host directives.

1. Update the System

As always, make sure your CentOS 7 VPS is fully up-to-date and you’re in a screen session using the commands below:

## screen -U -S lamp-centos7
## yum update

2. Install MariaDB

MariaDB is the default database server in CentOS 7, so go ahead and install it with yum using the following command:

You can create a test info.php script too using the following command:

## echo -e "<?php\n\tphpinfo();" > /var/www/html/info.php

and access it with the following command:

## curl -I $(curl -s icanhazip.com)/info.php

9. Set Up Apache VHosts

Now, you would have to set-up Apache Virtual Host Directives, to be able to host multiple domains, even SSL powered ones using one IP address. So, create /etc/httpd/conf.d/vhosts.conf and add the following:

This tells Apache, to load the configuration files ending with .conf which reside in /etc/httpd/vhosts.d. As you can guess, this is the place where we put our Virtual Hosts, so let’s set-up one for domain1.com and another for domain2.net

10. Restart Apache Server

Of course you don’t have to install LAMP on CentOS 7, if you use one of our CentOS 7 Hosting Plans, in which case you can simply ask our expert Linux administrators to install LAMP on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to install LAMP on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.