How to set up a LAMP stack on Centos8 / RHEL 8

by Anish

Posted on Wednesday October 30-2019


In this tutorial we will install LAMP on Centos8 with FPM enabled. Here are the listed LAMP component which is going to be installed.

Application Version Description
httpd 2.4.37 Base Apache
mod_ssl & openssl openssl-1.1.1 For TLS processing
mariadb-server & mariadb 10.3.11 The Database Server
php 7.2.11 Base PHP
php-mysqlnd 7.2.11 PHP MySQL Library
php-fpm 7.2.11 FPM (FastCGI Process Manager)
php-xml 7.2.11 PHP SimpleXML Parser
php-mbstring 7.2.11 PHP Multibyte String
  1. Update System first
dnf -y update
  1. Install Helper APP
dnf -y install nano curl wget bind-utils 
  1. Install LAMP with MariaDB
dnf -y install mariadb-server mariadb php php-fpm php-xml php-json php-mysqlnd php-mbstring php-opcache php-gd php-cli firewalld mod_ssl
  1. Enable Load on Startup for httpd MariaDB and PHP-FPM
systemctl enable httpd.service
systemctl enable php-fpm.service
systemctl enable mariadb.service
  1. Configure Firewalld and Allow HTTP/HTTPS
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
  1. Create simple PHP Info page to verify PHP is working in Apache in the /var/www/html/info.php

  1. Fix the File permissions to purely configured as Non-Root User
chown -R apache:apache /etc/run/
chown -R apache:apache /var/www
chown -R apache:apache /etc/httpd 
  1. Start the Apache httpd server
systemctl start httpd.service
systemctl status httpd
  1. Test It
# curl -I  http://localhost/        
HTTP/1.1 200 OK
Date: Wed, 30 Oct 2019 05:20:02 GMT
Server: Apache/2.4.37 (centos) OpenSSL/1.1.1
Last-Modified: Wed, 30 Oct 2019 05:16:20 GMT
ETag: "69-59619d551e9d9"
Accept-Ranges: bytes
Content-Length: 105

PHP Info

You can also run the following command to list installed modules only:

php -m
  1. Start & Configure MariaDB
systemctl start mariadb.service
systemctl status mariadb

Once MariaDB is started, complete the series of questions likeHow to Secure MariaDB by setting root password


Video Demo

That's ALL (Nope )

Next Reading : How to Monitoring All Executed Commands in Linux

Thanku for reading !!! Give a Share for Support

Your Support Matters!

Instead of directly asking for donations, I'm thrilled to offer you all nine of my books for just $9 on leanpub By grabbing this bundle you not only help cover my coffee, beer, and Amazon bills but also play a crucial role in advancing and refining this project. Your contribution is indispensable, and I'm genuinely grateful for your involvement in this journey!

Any private key value that you enter or we generate is not stored on this site, this tool is provided via an HTTPS URL to ensure that private keys cannot be stolen, for extra security run this software on your network, no cloud dependency

python Cryptography Topics
For Coffee/ Beer/ Amazon Bill and further development of the project Support by Purchasing, The Modern Cryptography CookBook for Just $9 Coupon Price

Kubernetes for DevOps

Hello Dockerfile

Cryptography for Python Developers

Cryptography for JavaScript Developers

Go lang ryptography for Developers