In this tutorial, learn how to set up a LAMP (Linux, Apache, MariaDB, and PHP) server on Rocky Linux.
- Rocky Linux server (need a server? Get $100 free Vultr credits when you use my referral link. Credits added during sign up)
- SSH root or sudo access to the server
Please note that a complete video tutorial is available at the end of this tutorial.
1. Update Rocky Linux
It’s always good practice to update your system before installing any new packages.
2. Install Apache Web Server
Install the Apache web server, start it up, and enable it to automatically startup at boot with the following commands.
dnf install httpd systemctl start httpd systemctl status httpd systemctl enable httpd
At this point, you can go to the IP address of your web browser and see the default Apache landing page for Rocky Linux.
The source for this page exists at
3. Install PHP
While you can install any version of PHP that Rocky Linux supports, this tutorial will show you how to install PHP 7.4.
dnf module list php dnf module enable php:7.4 dnf install php
Check the version of PHP that is installed.
Start up PHP-FPM and enable it to automatically start at system boot.
systemctl start php-fpm systemctl status php-fpm systemctl enable php-fpm systemctl restart httpd php-fpm
4. Install MariaDB
Install the database, start it up, and enable it to automatically start at system boom.
dnf install mariadb-server systemctl start mariadb systemctl status mariadb systemctl enable mariadb
Secure the MariaDB installation by setting a root password. Answer Y to all prompts.
The database command prompt is accessible with this command. Please provide the password that you just created in the previous step.
mysql -u root -p
From here, you can create the website of your choice including WordPress on Rocky Linux.