Cybersecurity Updates & Tools

Install Joomla on Ubuntu 18.04 with Apache: LAMP Stack Guide

Joomla is one of the most popular open-source content management systems in the world. It is written in PHP and comes with a large ecosystem of extensions and templates that can turn it into an e-commerce store, a community portal, a business site, or a blog. It is a strong alternative to WordPress, particularly for projects that need finer-grained user roles and access control built into the core.

This guide walks you through installing Joomla on Ubuntu 18.04 with Apache using a LAMP stack (Linux, Apache, MySQL/MariaDB, PHP 7.2), all running behind HTTPS.

Prerequisites:

  • A domain name pointing to your server’s public IP
  • Apache installed and running
  • A Let’s Encrypt SSL certificate installed for your domain

Install Joomla on Ubuntu: Create the MySQL Database

Joomla stores articles, categories, users, extensions, and configuration data in a MySQL or MariaDB database. If MySQL is not already installed on your server, install it first:

bashsudo apt-get updatesudo apt-get install mysql-server

Log into the MySQL shell:

bashsudo mysql

Create a dedicated Joomla database with the correct character set:

sqlCREATE DATABASE joomla CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Create a database user and grant it full access. Replace the placeholder with a strong password:

sqlGRANT ALL ON joomla.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

Exit the MySQL shell:

sqlEXIT

Install PHP 7.2 and Download Joomla Files

PHP 7.2 is the default version on Ubuntu 18.04 and is fully supported by Joomla. Install it along with all required extensions:

bashsudo apt install php7.2 php7.2-cli php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-intl php7.2-xml php7.2-gd php7.2-zip php7.2-curl php7.2-xmlrpc

Joomla requires specific PHP settings that differ from the Ubuntu defaults. Apply them with these sed commands:

bashsudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.2/apache2/php.inisudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.2/apache2/php.inisudo sed -i "s/post_max_size = .*/post_max_size = 256M/" /etc/php/7.2/apache2/php.inisudo sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php/7.2/apache2/php.inisudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/apache2/php.ini

Restart Apache to load the new PHP configuration:

bashsudo systemctl restart apache2

Create the document root and download the Joomla release archive:

bashsudo mkdir -p /var/www/example.comcd /var/www/example.comsudo wget https://downloads.joomla.org/cms/joomla3/3-9-4/Joomla_3-9-4-Stable-Full_Package.zipsudo unzip Joomla_3-9-4-Stable-Full_Package.zip

Set the correct ownership so Apache can read and write the Joomla files:

bashsudo chown -R www-data: /var/www/example.com

Configure Apache and Complete the Web Installer

Create an Apache virtual host configuration file for your domain:

bashsudo nano /etc/apache2/sites-available/example.com.conf

Paste the following configuration, replacing example.com with your domain and updating the SSL certificate paths:

apache<VirtualHost *:80>  ServerName example.com  Redirect permanent / https://example.com/</VirtualHost><VirtualHost *:443>  ServerName example.com  DocumentRoot /var/www/example.com  SSLEngine On  SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem  SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem  <Directory /var/www/example.com>    AllowOverride All    Require all granted  </Directory></VirtualHost>

Enable the virtual host and restart Apache:

bashsudo a2ensite example.comsudo systemctl restart apache2

Open your domain in a browser. The Joomla setup wizard walks you through three screens:

Step 1 – Main Configuration: Enter your site name, a fallback meta description, and the admin account details. Set the admin username to something other than admin for security, and choose a strong password.

Step 2 – Database Configuration: Leave the type as MySQLi and the hostname as localhost. Fill in the database name (joomla), username (joomlauser), and the password you created earlier. Leave the table prefix as the auto-generated value.

Step 3 – Overview: Review your settings and confirm the pre-installation checks pass. Click Install to complete the setup.

After installation, Joomla prompts you to remove the installation directory. Do this immediately — leaving it in place is a security risk:

bashsudo rm -rf /var/www/example.com/installation

Access the Joomla administration panel at https://example.com/administrator.

Joomla is now installed and running on your Ubuntu 18.04 server. Visit the Joomla Documentation to learn about extensions, templates, and user management. Leave a comment below if you run into any issues.