How to Install Joomla with LAMP on Rocky Linux 9

Install Joomla with LAMP Stack on Rocky Linux 9 using PHP 8.4, MariaDB 10.11, Apache, firewalld, SELinux, and HTTPS in about 20 minutes from a fresh VPS.
A polished Rocky Linux server rack with a web panel, database cylinder, and green-blue light trails in a dark data center.

Install Joomla with LAMP Stack on Rocky Linux 9 and finish with a Joomla 6.1.4 website served by Apache, MariaDB, PHP 8.4, and HTTPS. Plan on about 20 minutes for a fresh VPS, including the browser installer.

Prerequisites

  • A fully updated Rocky Linux 9 server with at least 2 GB of RAM and 10 GB of free disk space.
  • SSH access as root or a sudo-enabled user. Keep the current SSH session open while you change firewall rules.
  • A public IPv4 address and a domain such as YOUR_DOMAIN pointing to SERVER_IP; ports 80 and 443 must be reachable.
  • A long database password, a different Joomla Super User password, and an email address for certificate renewal notices.
  • A VPSLake Linux VPS with root access is a suitable base for this Apache and MariaDB setup.

Joomla 6 requires PHP 8.3 or newer and recommends PHP 8.4. Rocky Linux 9’s original PHP stream is older, so this guide enables Remi’s PHP 8.4 module and uses Rocky’s MariaDB 10.11 stream. Joomla’s official technical requirements list the required PHP extensions and database versions.

Step 1: Install the Rocky Linux 9 LAMP packages

Rocky 9 supplies Apache, MariaDB, and firewalld, while EPEL and Remi provide the current PHP stream and Certbot packages needed by Joomla 6.

sudo dnf upgrade -y
sudo dnf install -y dnf-plugins-core epel-release
sudo dnf config-manager --set-enabled crb
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.4 -y
sudo dnf module reset mariadb -y
sudo dnf module enable mariadb:10.11 -y
sudo dnf install -y httpd mariadb-server firewalld php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-zip unzip curl policycoreutils-python-utils certbot python3-certbot-apache mod_ssl
sudo tee /etc/php.d/90-joomla.ini > /dev/null <<'PHP'
memory_limit = 256M
upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 60
PHP
sudo systemctl enable --now firewalld httpd mariadb php-fpm

Allow SSH and web traffic, but leave MariaDB private because Joomla will use a local connection.

sudo firewall-cmd --permanent --zone=public --add-service=ssh
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
php -v
sudo systemctl is-active httpd mariadb php-fpm firewalld

The PHP line should begin with 8.4, and the service check should print active four times.

PHP 8.4.x (cli) ...
active
active
active
active

Step 2: Secure MariaDB and create the Joomla database

The MariaDB security script removes anonymous accounts and sample data before the application receives its own local database login.

sudo mariadb-secure-installation

Remove anonymous users, disable remote root login, remove the test database, and reload the privilege tables when prompted. MariaDB may phrase the root-password questions differently depending on how the package was initialized.

Create a UTF-8 database and grant it to a dedicated user. Replace YOUR_DB_PASSWORD with a unique password before running the block; the value will be entered in Joomla’s web installer.

sudo mariadb <<'SQL'
CREATE DATABASE joomla CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'joomla_user'@'localhost' IDENTIFIED BY 'YOUR_DB_PASSWORD';
GRANT ALL PRIVILEGES ON joomla.* TO 'joomla_user'@'localhost';
FLUSH PRIVILEGES;
SQL
sudo mariadb -e "SHOW DATABASES LIKE 'joomla';"

The last command should return one row named joomla. Do not open port 3306 for this deployment.

Step 3: Download Joomla and prepare SELinux-aware permissions

The official full package contains the Joomla installer. The ownership layout below makes the application tree readable to Apache while reserving write access for runtime directories.

The official Joomla downloads page currently lists Joomla 6.1.4. Download that full package over HTTPS and create the clean-URL file from Joomla’s template.

cd /tmp
curl -fL --proto '=https' --tlsv1.2 -o Joomla_6-1-4-Stable-Full_Package.zip 'https://downloads.joomla.org/cms/joomla6/6-1-4/Joomla_6-1-4-Stable-Full_Package.zip?format=zip'
sudo mkdir -p /var/www/joomla
sudo unzip -q Joomla_6-1-4-Stable-Full_Package.zip -d /var/www/joomla
sudo cp /var/www/joomla/htaccess.txt /var/www/joomla/.htaccess
sudo chown -R root:apache /var/www/joomla
sudo find /var/www/joomla -type d -exec chmod 0750 {} +
sudo find /var/www/joomla -type f -exec chmod 0640 {} +
sudo install -o apache -g apache -m 0660 /dev/null /var/www/joomla/configuration.php
sudo mkdir -p /var/www/joomla/cache /var/www/joomla/administrator/cache /var/www/joomla/images /var/www/joomla/media /var/www/joomla/tmp /var/www/joomla/administrator/logs
sudo chown -R apache:apache /var/www/joomla/cache /var/www/joomla/administrator/cache /var/www/joomla/images /var/www/joomla/media /var/www/joomla/tmp /var/www/joomla/administrator/logs
sudo find /var/www/joomla/cache /var/www/joomla/administrator/cache /var/www/joomla/images /var/www/joomla/media /var/www/joomla/tmp /var/www/joomla/administrator/logs -type d -exec chmod 0770 {} +
sudo find /var/www/joomla/cache /var/www/joomla/administrator/cache /var/www/joomla/images /var/www/joomla/media /var/www/joomla/tmp /var/www/joomla/administrator/logs -type f -exec chmod 0660 {} +

Keep SELinux enforcing. These persistent contexts allow Apache to read the site and write only to the configuration file during setup and the directories Joomla needs at runtime.

sudo semanage fcontext -a -t httpd_sys_content_t '/var/www/joomla(/.*)?'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/joomla/configuration.php'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/joomla/(cache|administrator/cache|images|media|tmp|administrator/logs)(/.*)?'
sudo restorecon -RFv /var/www/joomla

Step 4: Configure Apache for Joomla

This virtual host maps your domain to Joomla and permits the .htaccess rules used by Search Engine Friendly URLs. Replace YOUR_DOMAIN and ADMIN_EMAIL before running it.

sudo tee /etc/httpd/conf.d/joomla.conf > /dev/null <<'APACHE'
<VirtualHost *:80>
    ServerName YOUR_DOMAIN
    ServerAdmin ADMIN_EMAIL
    DocumentRoot /var/www/joomla

    <Directory /var/www/joomla>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    DirectoryIndex index.php index.html
    ErrorLog /var/log/httpd/joomla-error.log
    CustomLog /var/log/httpd/joomla-access.log combined
</VirtualHost>
APACHE
sudo apachectl configtest
sudo apachectl -M | grep -E 'rewrite|proxy_fcgi'
sudo systemctl reload httpd

Syntax OK, rewrite_module, and proxy_fcgi_module confirm that Apache accepted the site configuration and can pass PHP requests to PHP-FPM. If DNS is not ready, curl -I http://SERVER_IP/ still checks the HTTP listener.

Step 5: Issue the Let’s Encrypt certificate

HTTPS protects the administrator and database credentials submitted by the browser. The domain must already resolve to this VPS before Certbot can complete its HTTP-01 challenge.

sudo certbot --apache --redirect --agree-tos --no-eff-email -m ADMIN_EMAIL -d YOUR_DOMAIN
sudo certbot renew --dry-run

Use an address you monitor for ADMIN_EMAIL. Certbot creates the TLS configuration, redirects HTTP to HTTPS, and the dry run checks future renewal without replacing the live certificate.

Step 6: Complete the Joomla browser installer

The web wizard writes configuration.php and creates Joomla’s tables. Open https://YOUR_DOMAIN/, set the site name and administrator details, then enter these database values:

  • Database type: MySQLi
  • Database host: localhost
  • Database name: joomla
  • Username: joomla_user
  • Password: the value used for YOUR_DB_PASSWORD
  • Table prefix: keep the generated value

Choose a unique Super User name and password. After the success screen, sign in at https://YOUR_DOMAIN/administrator and use Joomla’s prompt to remove the installation directory if it remains.

Lock the generated configuration file after the wizard finishes. Apache can still write to the prepared cache, media, image, temporary, and log paths, but it cannot alter the core configuration.

sudo chown root:apache /var/www/joomla/configuration.php
sudo chmod 0640 /var/www/joomla/configuration.php
sudo restorecon -v /var/www/joomla/configuration.php

Verify the Joomla LAMP installation

Run these checks over SSH, then load both the public site and administrator URL. They cover the daemons, Apache syntax, required PHP modules, database, generated configuration, and HTTPS response.

sudo systemctl is-active httpd mariadb php-fpm firewalld
sudo apachectl configtest
php -m | grep -Ei 'dom|gd|mbstring|mysqli|mysqlnd|pdo_mysql|SimpleXML|xml|zip'
sudo mariadb -e "SHOW DATABASES LIKE 'joomla';"
test -f /var/www/joomla/configuration.php && echo configuration.php-present
curl -fsSI https://YOUR_DOMAIN/

Success means four active lines, Syntax OK, the requested PHP modules, one joomla database row, configuration.php-present, and an HTTP 200 response or normal Joomla redirect.

active
active
active
active
Syntax OK
configuration.php-present
HTTP/2 200

Troubleshooting

No matching module streams for php:remi-8.4

The Remi release package or CRB repository was not enabled, or DNF is using stale metadata. Refresh the repository definitions and select the stream again; do not mix EL8 repositories into Rocky Linux 9.

sudo dnf config-manager --set-enabled crb
sudo dnf clean all
sudo dnf makecache
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.4 -y
sudo dnf install -y php php-fpm php-intl php-mbstring php-mysqlnd php-xml php-zip
sudo systemctl restart php-fpm httpd

The configuration file is not writable

Joomla needs a writable configuration.php while the browser installer is running. Check the Unix owner and SELinux label, temporarily restore the setup permissions, then lock the file again with Step 6 after installation.

sudo chown apache:apache /var/www/joomla/configuration.php
sudo chmod 0660 /var/www/joomla/configuration.php
sudo restorecon -v /var/www/joomla/configuration.php

PHP downloads instead of running, or the page returns 503 Service Unavailable

Apache is answering, but PHP-FPM is stopped or its socket configuration is unavailable. Check the service and recent log entries before reloading Apache.

sudo systemctl status php-fpm --no-pager
sudo journalctl -u php-fpm -n 40 --no-pager
sudo systemctl restart php-fpm httpd

Joomla URLs return 404 Not Found

Clean URLs require both the Apache rewrite module and Joomla’s .htaccess template. Recreate the file, confirm AllowOverride All in the vhost, and reload Apache.

sudo cp /var/www/joomla/htaccess.txt /var/www/joomla/.htaccess
sudo apachectl -M | grep rewrite
sudo apachectl configtest
sudo systemctl reload httpd

Hardening

  • Keep port 3306 closed and leave MariaDB bound to local access unless a separate application needs remote database connections.
  • Back up the joomla database and /var/www/joomla/configuration.php before Joomla core or extension updates.
  • Remove unused extensions, enable Joomla update notifications, and keep the Super User account protected with a unique password and MFA where available.

FAQ

Is Rocky Linux 9’s default PHP version enough for Joomla 6?

Not for the recommended setup. Joomla 6 requires PHP 8.3 or newer, while a stock Rocky Linux 9 installation may select an older AppStream version, so this guide enables Remi PHP 8.4.

Can I install Joomla using only the server IP address?

You can test Apache over HTTP by IP, but a domain is needed for a normal HTTPS certificate and a stable Joomla site URL. Point the domain to the VPS before running Certbot.

Why does the installer use localhost for MariaDB?

The database and web server are on the same VPS, so localhost uses a local connection and avoids exposing MariaDB publicly. The firewall therefore needs web and SSH services, not port 3306.

Which Joomla directories should remain writable?

Joomla normally needs write access to its cache, images, media, temporary, and administrator log directories. The final ownership command protects configuration.php and prevents the web process from changing the main site settings.

Samrat Ghosh
Written by

Samrat Ghosh

Founder & Infrastructure Engineer

Samrat Ghosh is the founder of VPSLake, where he builds and runs the remote desktop and VPS hosting infrastructure the company is built on. He writes hands-on guides about RDP, Windows Server, VPS management and secure remote access - the practical documentation he wishes had…

Previous Article

Self-Hosted RustDesk Server on a VPS: Ports, Size and Cost

Write a Comment

Leave a Comment

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

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨