In this tutorial we will explain how to install LAMP (Linux, Apache, MySQL / MariaDB, PHP).


A dedicated server or a VPS with minimal installation of CentOS 7.

Installation of Remi Repository on CentOS 7

The installation we are going to perform will be on CentOS 7, but the same instructions also work on distributions from RHEL and Fedora.

Lets use the following command to install and enable the Remi repository.

# yum -y install  

Since we will be using php7.3, we have to disable php5.4 installation using the yum-config-manager command provided by the yum-utils tool.

1   yum install yum-utils
2 yum-config-manager --disable remi-php54
3 yum-config-manager --enable remi-php73

Installing LAMP Stack on CentOS 7

Now we are ready to use the following command to install all the required packages related to our LAMP stack.

Installing PHP, MariaDB, Apache

1   yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt

Now that the installation is complete, our MariaDB installation will need to be started and secured.

1   systemctl start mariadb
2 mysql_secure_installation

Enable MariaDB for auto-start 

Follow the commands for securing your MariaDB server.Then we configure MariaDB to start automatically on the boot

1   systemctl enable mariadb

Enable Apache for auto-start 

Now we’re going to do the same for web server Apache:

1   systemctl start httpd
2 systemctl enable httpd


You completed the installation of LAMP on CentOS 7 successfully. Please submit them in the comment section below if you had any difficulties or questions.