This article walks you through a clean install of Joomla 5 on an Ubuntu 22.04 server, using Nginx, PHP 8.2 and MariaDB. It is for an administrator who is comfortable in a terminal and wants a site that stays secure once it is live, not only one that passes the installer. Joomla still ships as a zip file rather than a Composer package, so most of the work is getting the file layout, permissions and web server configuration right. You will install the PHP extensions Joomla needs, put Nginx in front of PHP-FPM, keep MariaDB on the local loopback address, add a Let’s Encrypt certificate and set the configuration.php options that matter. When you are done you will have a Joomla site you can leave running without watching it.
How to verify
After the install you should see:
curl -sI https://example.org/ | head -1
# HTTP/2 200
curl -s https://example.org/administrator/manifests/files/joomla.xml | grep -o '<version>[^<]*'
# <version>5.1.x
ls -la /var/www/joomla/ | grep -E '(installation|configuration.php)'
# -r--r----- 1 deployer www-data configuration.php
# (no installation/ directory — must have been removed)
sudo -u www-data find /var/www/joomla -maxdepth 2 -type d -perm -o+w
# (must be empty — no world-writable directories)
ss -lntp | grep ':3306'
# 127.0.0.1:3306 mariadbd
If installation/ still exists, the public site will refuse to render until you delete it — that is the only safety net Joomla provides.
What’s happening
Joomla is a PHP application that follows the classic LAMP/LEMP layout but with one quirk: the configuration is a PHP file (configuration.php) at the document root, not a JSON or YAML file outside it. That file holds the database password, the secret, and the mail config — set it to mode 444 owned by the deploy user, group www-data. Joomla writes to a small set of directories: administrator/cache, cache, tmp, images, media, and logs. Everything else should be read-only to the web server user.
The release is shipped as a zip. The recommended path is to download the latest 5.x release, unzip it into the webroot, then load https://your-site/installation/ once for the web installer. That installer writes configuration.php and seeds the database. Once it finishes, it asks you to delete the installation/ directory; do not skip that step. There is no composer install to run — extensions are added through the Joomla admin or by dropping their zip into /administrator/index.php?option=com_installer.
Joomla 5 dropped some legacy code from 4.x — the J3 compatibility plugin is the bridge for older extensions, but it is a temporary one. Audit your extension list before upgrading from a J3 site; the per-extension status pages on the JED list a “J5 compatible” badge that is usually accurate.
The procedure
-
Install the LEMP base and PHP extensions.
sudo apt update sudo apt install -y nginx mariadb-server \ php8.2-fpm php8.2-mysql php8.2-gd php8.2-curl \ php8.2-mbstring php8.2-xml php8.2-zip php8.2-intl \ php8.2-bcmath php8.2-opcache php8.2-apcu \ unzip wget -
Create the database and user.
DBPASS=$(openssl rand -hex 24) sudo mariadb <<SQL CREATE DATABASE joomla CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'joomla'@'127.0.0.1' IDENTIFIED BY '${DBPASS}'; GRANT ALL ON joomla.* TO 'joomla'@'127.0.0.1'; FLUSH PRIVILEGES; SQL echo "$DBPASS" | sudo tee /root/.joomla-dbpass >/dev/null sudo chmod 600 /root/.joomla-dbpass -
Download and unpack Joomla 5. Always check the SHA from the Joomla downloads page.
sudo useradd -m -s /bin/bash deployer sudo usermod -aG www-data deployer sudo mkdir -p /var/www/joomla && sudo chown deployer:www-data /var/www/joomla sudo -u deployer -- bash -lc ' cd /var/www/joomla wget -q https://downloads.joomla.org/cms/joomla5/5-1-2/Joomla_5-1-2-Stable-Full_Package.zip unzip -q Joomla_5-1-2-Stable-Full_Package.zip rm Joomla_5-1-2-Stable-Full_Package.zip ' sudo chown -R deployer:www-data /var/www/joomla sudo find /var/www/joomla -type d -exec chmod 750 {} \; sudo find /var/www/joomla -type f -exec chmod 640 {} \; -
Configure Nginx at
/etc/nginx/sites-available/joomla:server { listen 443 ssl http2; server_name example.org; root /var/www/joomla; index index.php; ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* /(configuration\.php|\.git|\.env) { deny all; } location ~ /administrator/logs/ { deny all; } }Run
certbot --nginx -d example.org, enable the site, reload Nginx. -
Run the web installer. Browse to
https://example.org/installation/. Enter the database details from step 2, set the admin password to something the password manager generated, finish. -
Delete the installation directory — the only post-install safety prompt in Joomla:
sudo -u deployer rm -rf /var/www/joomla/installation -
Lock
configuration.phpdown.sudo chmod 444 /var/www/joomla/configuration.phpInside the file, set
$error_reporting = 'none';,$secretto a fresh 32-byte hex fromopenssl rand -hex 16,$tmp_path = '/var/www/joomla/tmp';, and$log_path = '/var/www/joomla/administrator/logs';(outside the webroot is better — adjust the deny in Nginx accordingly). -
Add the Joomla cron. Joomla 4+ has a CLI scheduler that replaces the in-admin “task” cron:
echo '*/5 * * * * deployer cd /var/www/joomla && php cli/joomla.php scheduler:run --quiet' \ | sudo tee /etc/cron.d/joomla
Common pitfalls
- The web installer happily writes a
configuration.phpowned bywww-datawith mode 644 — always re-set ownership and mode by hand after install. - Joomla’s “Two-Factor Authentication” plugin must be enabled per user and in the global plugin manager — turning it on in only one place silently does nothing.
- The
tmpdirectory accumulates extension install leftovers; clean it on a schedule or it will eventually fill the disk on long-lived sites. - Update channel mismatches: the admin shows “no update available” if your update server URL is pointed at the J4 channel after a J5 install — verify
Components > Joomla! Update. - SEF URLs depend on Nginx
try_files; if you ported from Apache.htaccess, double-check the rewrites because the snippets that float around the web are usually wrong for/component/users/?view=login&return=....
For clients on Joomla, Stack Harbor runs the boring half — updates pinned through the Joomla updater with rollback snapshots, extension inventory audited, file permissions enforced by a cron, mail transport monitored — so the editorial team only sees the admin. That’s the model behind managed operations, with more notes in the knowledge base.