How to install LAMP in Centos 8 (php 7.4 + mariadb 10.5 + Apache 2.4)


Welcome, to start with this quick guide on how to install LAMP, we will use the following commands in your SSH terminal as putty, once logged into the terminal we will enter the following commands below:


  • dnf install
  • dnf install
  • dnf module list php
  • dnf module enable php:remi-7.4
  • dnf install php php-{cli,common,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip}
  • dnf install tar unzip git redis nano wget


Copy all the following text, then paste and enter.


sudo tee /etc/yum.repos.d/mariadb.repo<<EOF
name = MariaDB
baseurl =


Continue with the following commands


  • sudo yum makecache
  • dnf install httpd mariadb-server php php-cli php-json php-mbstring php-pdo php-pecl-zip php-mysqlnd -y
  • systemctl start mariadb
  • systemctl enable mariadb
  • mysql_secure_installation


After the command "mysql_secure_installation" it will ask you to change the mysql password, enter a password and press "Enter", then you will also get 4 more options which we only write "Y" and then enter, once finished we verify our installation with the following commands :


  • php -v
  • mysql -v
  • httpd -v



Was this answer helpful? 0 Users Found This Useful (0 Votes)