How to install Joomla 4.2.2 on Ubuntu 20.04?


Joomla is a Content Management System (CMS) that is open-source and used to create stunning websites and potent online applications. It is built on PHP and frequently set up to use MariaDB/MySQL databases.

This tutorial will guide you with the steps to set up Joomla 4.2.2 on Ubuntu 20.04.


There are certain prerequisites that need to be met before you begin:

  • PHP 5.3.10 or newer (recommended 7.3+)

  • MySQL 5.1+ (recommended 5.5.3)

  • Apache 2.0 or above

  • A user account with 'sudo' or administrative rights.

  • Internet accessibility

Note: If the required environment is already set, you may skip directly to Step 5.

Get Started

Step 1: Login as: ubuntu

Login through SSH on an SSH client like MobaXterm or Putty and run the command below to make sure your system is of the latest version:

1. To update the package list with the latest available versions:

sudo apt-get update 

2. To actually upgrade and install the latest versions of packages that are already installed:

sudo apt-get upgrade 

Step 2: PHP and Apache Server Installation

To run, Joomla needs a web server. Here, we will use the Apache server, which is commonly used worldwide. The following command can install the setup from Ubuntu's official repositories:

1. Apache installation:

sudo apt install apache2 

2. When the server boots up after Apache installation, you can use the following commands to start, stop, and activate Apache services:

sudo systemctl start apache2.service  
sudo systemctl stop apache2.service 
sudo systemctl enable apache2.service 

3. Verify Apache's running status by executing the following command:

sudo systemctl status apache2 

You have to carry out PHP installation as well because Joomla is based on PHP. Also, Joomla templates usually contain PHP statements, so it is necessary for building webpages.

1. By executing the following command, you'll install PHP, plus additional related packages:

sudo apt install php php-common libapache2-mod-php php-cli php-fpm php-mysql php-json php-opcache php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-xml php-zip 

2. Run the command below to verify the PHP if it is installed successfully:

php –v 

Step 3: Install MariaDB

For this tutorial, we will set up the MariaDB server, a derivative of MySQL, since installing a relational database server is necessary because Joomla needs database to store its data on the backend. Run the following command to install the DB:

sudo apt install -y mariadb-server mariadb-client 

Securing database installation

1. Enter as the root user first, using the below command:

sudo -i 

2. Set a new password for the root user with the following command:


3. Run the following command to protect the installation:


After the installation is finished, follow the instructions for setting up the privileges of the database:

Enter the current password for root (enter for none): 
Set root password? [Y/n] Y 
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y 
Disallow root login remotely? [Y/n] Y 
Remove test database and access it? [Y/n] Y 
Reload privilege tables now? [Y/n] Y 

Now, you need a storage solution for keeping your Joomla site's data.

Step 4: Database creation for Joomla

1. As the next step, a user and database must be created for its installation. To establish the connection to MariaDB initially, use the following command:

mysql -u root -p 

2. Create a DB, user and password by using the following script:

MariaDB [(none)]> CREATE DATABASE joomla; 
MariaDB [(none)]> GRANT ALL PRIVILEGES ON joomla. * TO 'joomla'@'localhost' IDENTIFIED BY  'StrongPassword'; 
MariaDB [(none)]> FLUSH PRIVILEGES; 
MariaDB [(none)]> EXIT; 

MariaDB has now been installed and is ready for Joomla installation.

Step 5: Joomla Installation

1. As your environment has been configured, you may start the installation.

Download the Joomla package from Joomla! 4.2.2 downloads page with the command below:


Extracted files should be moved to the directory, whose path is /var/www/html/joomla, which will serve as root directory for your Joomla site, after you have finished unzipping the archive.

2. First, we need to install the unzip library, with the following command:

sudo apt install zip unzip 

3. For unzipping the package, run the following command:

sudo unzip -d /var/www/html/joomla 

4. Run the following command to give the www-data user proprietorship ofcthe /var/www/html/joomla directory:

sudo chown -R www-data: /var/www/html/joomla 

Step 6: Apache Configuration for Joomla

1. To install Joomla, you must build a virtual host file for maintaining Apache's configurations. This file will help to set the configurations to allow more than one website on a single server. The following command will aid you in creating it:

nano /etc/apache2/sites-available/joomla.conf 

2. Mention the script below in the configuration file created above:

<VirtualHost *:80> 
     DocumentRoot /var/www/html/joomla/ 
     <Directory /var/www/html/joomla/> 
          Options FollowSymlinks 
          AllowOverride All 
          Require all granted 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
  1. After saving and closing the file, run the following command to activate Joomla’s virtual host:

a2ensite joomla.conf 
  1. Apply the changes next by restarting the Apache server with the following command.:

systemctl restart apache2 

Now, you need to access (<your domain> will be your IP address) in your web browser.

Follow the instructions on the screen to finish the installation:

  1. Enter the name of your site and choose your desired language, as shown in the image below:

  2. For Joomla 4.2.2 administrator account, configure the name, username, password, and email address of the Super User.

Note: The passwords must be 12 characters long at least.

3. Set up the database configuration. The table below the image explains the required fields.

After filling out the details, click on Install Joomla.

  1. You'll land upon the additional settings page, from where you can view the Joomla 4.2.2 home page by clicking the 'Open Site' button.

  2. Now, you will land on the login page, from where you can get started by entering your credentials.


Joomla 4.2.2 is now properly installed on Ubuntu 20.04. You may take a reference from the official Joomla manual for further details and queries on Joomla installation.

Last updated