CALL US: +91-9971329945 / +91-120-4312792 Live Chat Submit Ticket   Login
LAMP Installation on CentOS 7

In this blog, we will learn installing LAMP. In this “L” stands for ‘Linux’, “A” stands for Apache, “M” stands for MariaDB and “P” stands for PHP. Since we are already working on a Linux machine so we are only required to install Apache, Mysql and PHP on our server.

 

 

1. Apache Installation

 

Introduction:

Apache web server is an open-source HTTP server, which is responsible for establishing a connection between a client and a server besides providing the facility of sending and receiving data between them. Installing the Apache webserver on our server allows us to access the web content. Web server basically converts web pages written in various programming languages such as Python, Ruby, PHP etc. into HTML pages and display these HTML web pages on the web browser of the client that made the request.

 

Installation:

Let’s begin with the installation of Apache webserver on our Centos7.

type the command below to begin installing apache

# sudo yum install httpd

 

Apache web server is now installed on your server but we have to start it first, So start apache web server by the following command.

# sudo systemctl start httpd.service

 

By deafult when we start new session of our server apache is disable, but we want whenever we start new session apache starts automatically to enable this type the command given below.

# sudo systemctl enable httpd.service

 

 

2. MariaDB Installation

 

Mysql and MariaDB are RDBMS (Relational Database Management System) used to manage the database. MariaDB database is installed on CentOS instead of Mysql Database as Mysql DB is no longer available in CentOS repositories.

 

Let’s begin installing MariaDB server on our centos

# sudo yum install mariadb-server mariadb

 

  • Press ‘y’ when asked during MariaDB installation.

Start the MariaDB server

# sudo systemctl start mariadb

 

Installing MariaDB

# sudo mysql_secure_installation

 

You will be getting these prompts during installation simply follow these steps

  • Enter current password for root (enter for none): “Simply press Enter
  • Set root password? [Y/n] “Type” y
  • New password: “Set password for your MariaDB” [Don’t forget to note down this Password]
  • Remove anonymous users? [Y/n] y
  • Disallow root login remotely? [Y/n] y
  • Remove test database and access to it? [Y/n] y

Now Enable MariaDB

# sudo systemctl enable mariadb.service

 

Restart MariaDB to refresh.

# service mariadb restart

 

Now you can access MariaDB database and can create and perform various operations on the database.

Here in this case logging as root user

# mysql  -u  root  -p

 

Enter the password you set for MariaDB during its installation. Now you have entered the DBMS simply you can type the mysql commands to create databases and much more.

 

To exit MariaDB simply type “Exit”.

 

 

3. Installing PHP

 

Setting up yum repository to download and install PHP on our centos server.

# sudo yum install epel-release

 

# sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

 

Install PHP 7.3

# yum –enablerepo=remi-php73 install php

 

Install PHP 7.2

# yum –enablerepo=remi-php72 install php

 

Install PHP 7.1

# yum –enablerepo=remi-php71 install php

 

Check the version of PHP installed on our server by

# php -v

 

 

Congratulations !!! Linux, Apache, Mysql and PHP (LAMP) is successfully installed on your server.