Table of Contents
- Step 1: Update Repositories
- Step 2: Install Apache Web Server
- Step 3: Start Apache Service
- Step 4: Enable Apache to Start on Boot
- Step 5: Update Firewall Settings (Optional)
- Step 6: Install MySQL (MariaDB)
- Step 7: Start MySQL Service
- Step 8: Enable MySQL to Start on Boot
- Step 9: Secure MySQL Installation
- Step 10: Install PHP
- Step 11: Restart Apache for PHP Integration
- Step 12: Test Your LAMP Stack
To install a LAMP (Linux, Apache, MySQL, PHP) stack on AlmaLinux, follow the steps below:
Step 1: Update Repositories
sudo dnf updateStep 2: Install Apache Web Server
sudo dnf install httpdStep 3: Start Apache Service
sudo systemctl start httpdStep 4: Enable Apache to Start on Boot
sudo systemctl enable httpdStep 5: Update Firewall Settings (Optional)
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reloadStep 6: Install MySQL (MariaDB)
sudo dnf install mariadb-server mariadbStep 7: Start MySQL Service
sudo systemctl start mariadbStep 8: Enable MySQL to Start on Boot
sudo systemctl enable mariadbStep 9: Secure MySQL Installation
sudo mysql_secure_installationStep 10: Install PHP
sudo dnf install php php-mysqlndStep 11: Restart Apache for PHP Integration
sudo systemctl restart httpdStep 12: Test Your LAMP Stack
Create a PHP info file to test your installation:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.phpVisit “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.