Install LAMP Stack on Rocky Linux

#Introduction

In this tutorial, How to Install LAMP Stack on Rocky Linux

Install Apache on Rocky Linux

dnf install -y httpd httpd-devel httpd-tools

Enable apache start at boot time

systemctl enable httpd

start the Apache HTTPd daemon

systemctl start httpd

To check apache running on Rocky Linux

systemctl status httpd

The output terminal as below

Install LAMP Stack on Rocky Linux

Opens a browser that can access your Server’s IP address

http://Your-IP-address
OR
http://domain.com
Install LAMP Stack on Rocky Linux

Install MariaDB on Rocky Linux

dnf install mariadb-server mariadb

The output terminal as below

Install LAMP Stack on Rocky Linux

Enable MariaDB start at boot time

systemctl enable --now mariadb

start the MariaDB daemon

systemctl start mariadb

To check MariaDB running on Rocky Linux

systemctl status mariadb

Additional steps to harden the database server.

mysql_secure_installation
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Install PHP on Rocky Linux

The default PHP stream is PHP 7.2

To install the latest module Stream. We will reset the PHP streams.

dnf module reset php

Install PHP 7.4

dnf module install php:7.4

The output terminal as below

Install LAMP Stack on Rocky Linux

Install additional PHP extensions

dnf install php-cli php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd

Confirm the version of PHP installed

php -v

The output terminal as below

Install LAMP Stack on Rocky Linux

We create a test PHP file in the /var/www/html path.

vi /var/www/html/info.php

The content info.php as below

<?php
phpinfo();
?>

Save the changes and restart the webserver.

systemctl restart httpd

Open back browser

http://server-ip/info.php

The output as below

Install LAMP Stack on Rocky Linux

Remove file test PHP

rm -f /var/www/html/info.php

Conclusion

You have to Install LAMP Stack on Rocky Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!

,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.