Installing LAMP Stack on AlmaLinux

To install a LAMP (Linux, Apache, MySQL, PHP) stack on AlmaLinux, follow the steps below:

Step 1: Update Repositories

sudo dnf update

Step 2: Install Apache Web Server

sudo dnf install httpd

Step 3: Start Apache Service

sudo systemctl start httpd

Step 4: Enable Apache to Start on Boot

sudo systemctl enable httpd

Step 5: Update Firewall Settings (Optional)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Step 6: Install MySQL (MariaDB)

sudo dnf install mariadb-server mariadb

Step 7: Start MySQL Service

sudo systemctl start mariadb

Step 8: Enable MySQL to Start on Boot

sudo systemctl enable mariadb

Step 9: Secure MySQL Installation

sudo mysql_secure_installation

Step 10: Install PHP

sudo dnf install php php-mysqlnd

Step 11: Restart Apache for PHP Integration

sudo systemctl restart httpd

Step 12: Test Your LAMP Stack

Create a PHP info file to test your installation:

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

Visit “http://your_server_ip/info.php” in a web browser to see the PHP info page.

Now, you have successfully installed a LAMP stack on AlmaLinux. You can use this stack to host and run web applications.

You May Also Like
Proxmox commands cheat sheet terminal output
Read More

Proxmox Commands – cheat sheet

Managing Proxmox Virtual Environment (PVE) through the command line can significantly speed up administration tasks, especially when working…
secure ssh configuration changing default ssh port for linux and windows servers
Read More

How to Change the SSH Port

Why Change the Default SSH Port? Changing the default SSH port is a common security practice that helps…