How to install LAMP on Centos 7

lamp-centos


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

 

Colo-Serv Communications has written 20 articles

Premium Dedicated Server in Canada

Leave a Reply

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

nineteen + three =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>