Site icon installvirtual

How to install LAMP on Centos 7 / Redhat 7

How to install LAMP on Centos 7 / Redhat 7..

The LAMP stack os a group of three opensource application i.e. the most powerful webserver apache, MySQL and php.. In this tutorial we will learn how to install LAMP on Centos 7 and redhat 7..

Step 1: Install apache

The first thing we need to install is apache. Apache is most powerful and most widely used webserver.
We can install apache by centos default package manager ‘yum’.. So, lets get started.
We will use following command for installing apache:

yum -y install httpd

Then restart services and enable at boot apache.

systemctl restart httpd
systemctl enable httpd

You can verify whether apache is working or not by visiting  this ip address of the centos server

httpd://server-ip-address/

You will see the default apache page.. If you will see the default apache page it means you have successfully installed apache

Read Also: How to install drupal 7 on centos 7

Step 2 : Install MySQL (MariaDB in Centos 7)

Now we will install mariaDB in centos using yum

yum -y install mariadb-server mariadb

Now start the services of MariaDB

systemctl start mariadb

Now we need to set MariaDB root password and a run a script for security puposes.. Execute following script and set root password and hit enter for everything else..

mysql_secure_installation

And, Now enable MariaDB on boot by the following command.

systemctl enable mariadb

Read Also: How to install joomla on centos 7

Step 3 : Install php..

We can install php again using yum by following command

yum -y install php php-mysql

Now we need to restart httpd services in order to work with php

systemctl restart httpd

Install php modules

yum -y install php-fpm

Step 4 : Testing php on our server

For testing php we need to create a basic php script in /var/www/html directory as follows:

vim /var/www/html/info.php

Now we need to test whether php is working or not so we need to goto browser and visit following URL:

http://youripaddress/info.php

 

If you see this page means php is working successfully working and we have successfully installed LAMP stack on Centos 7. Now you can created good websites on LAMP stack..

If you have any problem using this tutorial feel free to comment below and keep subscribed for more tutorials..

Also read: How to install wordpress on centos 7

Exit mobile version