How to install and configure Linux, Apache, Mariadb and PHP (LAMP ) on Centos7

[Total: 1    Average: 5/5]

I’m going to show you how to install Apache, Mariadb and PHP on CentOS7 server and all these are the open source application and it’s easily available for the installation. You can install all these application on CentOS7 server with the yum ( Yellowdog Updater, Modified ) utility.


Short for Linux, Apache, MySQL and PHP, an open-source Web development platform, also called a Web stack, that uses Linux as the operating system, Apache as the Web server, MySQL as the RDBMS and PHP as the object-oriented scripting language. Perl or Python is often substituted for PHP


Proceed with the following step by step

1) Install Apache

  yum -y install httpd 

Now configure service to start Apache at boot time

systemctl start httpd.service
systemctl enable httpd.service 

Now browser to http://your-IP, and you should see the Apache2 page. It means Apache installed successfully

2) Install MariaDB

 yum -y install mariadb-server mariadb

Now start and configure service to start at boot time

systemctl start mariadb.service
systemctl enable mariadb.service 

Set passwords for the MySQL root account as follows :


3 Install PHP

We can install PHP5 and the Apache PHP5 module as follows:

yum -y install php php-mysql

Restart Apache

systemctl restart httpd.service

To test PHP5 we need to create phpinfo file

vi /var/www/html/info.php

Now add the following phpinfo code content in this file

Now browser a file as http://Your IP/phpinfo.php

If need any assistance then contact me. Skype ID is serversolutions24x7