How to install LAMP on Centos 7

banner dedicated


In this tutorial, we will show you how to install Apache, MySQL and PHP on CentOS 7.

 

Requirement :
CentOS 7 Dedicated Server

 

In the first part, we install Apache Webserver.

Install Apache Webserver

yum install httpd -y

 

Start and enable Apache onboot

systemctl start httpd.service
systemctl enable httpd.service

 

In the second part, we install the database server.

Install MySQL/MariaDB

yum install mariadb mariadb-server -y

 

Start and enable the Database server onboot

systemctl start mariadb.service
systemctl enable mariadb.service

 

You need now to secure your Database server

mysql_secure_installation
  • It will ask you to enter the current password : Type [Enter]
  • Enter your MySQL/MariaDB root password
  • Hit [enter] for all options.

 

In the last part, we install PHP and some basic PHP modules.

Install PHP and modules

yum install php php-mysql php-mbsting -y

 

Restart your Webserver

systemctl restart httpd.service

 

Test your new LAMP installation

Create a PHP file info in the Document root directory.

cd /var/www/html
nano index.php

 

Copy the following code in the file

<?php phpinfo(); ?>

 

Open your browser to test your LAMP

http://your_main_ip/index.php

 

banner dedicated


Colo-Serv Communications has written 32 articles

Premium Dedicated Hosting Services