• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Friday, May 23, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Install and Configure LAMP Stack on Rocky Linux

in Linux OS, Red Hat Enterprise Linux, Rocky Linux
How to Install and Configure LAMP Stack on Rocky Linux

LAMP (Linux, Apache, MySQL, PHP) stack is a popular, open-source web development platform that enables you to create dynamic web applications. In this tutorial, we’ll guide you through the process of how to install and configure LAMP Stack on Rocky Linux, a popular enterprise Linux distribution.

Table of Contents

  1. Update the System
  2. Install Apache
  3. Install MySQL
  4. Install PHP
  5. Configure LAMP Stack
  6. Test LAMP Stack

How to Install and Configure LAMP Stack on Rocky Linux

1. Update the System

Before installing LAMP Stack, it’s essential to update your Rocky Linux system. Open a terminal and run the following command to update all installed packages:

sudo dnf update -y

2. Install Apache

Apache is the most widely used web server software. To install Apache on your Rocky Linux system, execute the following command:

sudo dnf install httpd -y
Install Apache

After installation, enable and start the Apache service with these commands:

sudo systemctl enable httpd
sudo systemctl start httpd

To verify that Apache is running, open your web browser and navigate to http://localhost or http://your_server_IP. You should see the Apache test page.

3. Install MySQL

MySQL is a widely used, open-source relational database management system. You can install MySQL by adding the MySQL repository to your system, and then installing the MySQL server package. Run the following commands to install MySQL on Rocky Linux:

sudo dnf install https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm -y
sudo dnf install mysql-community-server -y
 Install MySQL

After installation, enable and start the MySQL service:

sudo systemctl enable mysqld
sudo systemctl start mysqld

To secure your MySQL installation, execute the following command and follow the prompts:

sudo mysql_secure_installation

4. Install PHP

PHP is a popular server-side scripting language. To install PHP and its extensions, run the following command:

sudo dnf install php php-mysqlnd php-fpm php-cli php-common -y
Install PHP

Now, enable and start the PHP-FPM service:

sudo systemctl enable php-fpm
sudo systemctl start php-fpm

5. Configure LAMP Stack

To configure the LAMP Stack, follow these steps:

  1. Open the Apache configuration file:
sudo vim /etc/httpd/conf.d/php.conf
  1. Uncomment the following lines:
# SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
  1. Restart the Apache and PHP-FPM services:
sudo systemctl restart httpd
sudo systemctl restart php-fpm

6. Test LAMP Stack

To test your LAMP Stack, create a PHP file in the Apache document root:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Now, open your web browser and navigate to http://localhost/info.php or http://your_server_IP/info.php. You should see the PHP information page displaying the current PHP version, configuration, and additional details.

Conclusion

Congratulations! You have successfully installed and configured a LAMP Stack on Rocky Linux. This setup enables you to host and develop web applications using Apache, MySQL, and PHP. Remember to secure your server and maintain it regularly.

If you’re interested in other tutorials for Rocky Linux, consider checking out these guides:

  • How to Install PowerDNS Server on Rocky Linux
  • How to Install KVM Virtualization on Rocky Linux
  • How to Install BIND DNS Server on Rocky Linux
  • How to Install VirtualBox on Rocky Linux
  • How to Install PostgreSQL on Rocky Linux

With your LAMP Stack now set up, you can start building powerful web applications and explore more advanced configurations and optimizations for your server.

ShareTweet
Previous Post

How to Install PowerDNS Server on Rocky Linux

Next Post

How to Add IPs on Rocky Linux: A Step-by-Step Guide

Related Posts

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

Set up FreeIPA on Rocky Linux

How to Install and Configure FreeIPA on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.