Linux

How To Install Linux, Apache, MariaDB, PHP On RHEL 8 : LAMP Stack

How To Install Linux, Apache, MariaDB, PHP On RHEL 8 : LAMP Stack

Insight: How To Install Linux, Apache, MariaDB, PHP On RHEL 8 : LAMP Stack

This is the quickest and the easiest way to install LAMP stack on RHEL 8. LAMP stack consists of Linux, Apache, MariaDB and PHP.

How To Install Linux, Apache, MariaDB, PHP On RHEL 8 : LAMP Stack

Install Apache

We hope that you already have installed RHEL 8 in your system. Let’s start our tutorial by installing Apache web server in your RHEL 8. You can install the httpd ( Apache) rpm package using the YUM command.

yum install -y httpd

Now run the following command to start the Apache web service by using the systemctl command.

systemctl start httpd

In order to make sure that Apache server starts automatically. Run the following command.

systemctl enable httpd

Configure firewall to allow external HTTP request.

firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload

 
Install MariaDB

Make sure that rhel-8-for-x86_64-appstream-rpms repository is enabled on your RHEL 8 system.

yum install -y mariadb mariadb-server

Run the following command to start the MariaDB server service using the systemctl command.

systemctl start mariadb

If you want to enable the MariaDB server to start during boot, run the following command .

systemctl enable mariadb

Check the MariaDB server status using the following command.

systemctl status mariadb

Now, run the following command to secure the MariaDB installation.

mysql_secure_installation

Install PHP
Now, let’s install PHP. Before installing Php, make sure that rhel-8-for-x86_64-appstream-rpms repository is enabled on your RHEL 8.

yum install -y php php-mysqlnd

Now, Restart the Apache Web server.

systemctl restart httpd