> For the complete documentation index, see [llms.txt](https://docs.acecloud.ai/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acecloud.ai/knowledge-base/tutorials/how-to-install-joomla-4.2.2-on-ubuntu-20.04.md).

# How to install Joomla 4.2.2 on Ubuntu 20.04?

### Overview

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.&#x20;

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

### **Prerequisites**

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

* PHP 5.3.10 or newer (recommended 7.3+)&#x20;
* MySQL 5.1+ (recommended 5.5.3)&#x20;
* Apache 2.0 or above&#x20;
* A user account with 'sudo' or administrative rights.&#x20;
* Internet accessibility&#x20;

{% hint style="info" %}
**Note: If the required environment is already set, you may skip directly to Step 5.**&#x20;
{% endhint %}

### **Get Started**

**Step 1: Login as: ubuntu**&#x20;

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:&#x20;

```
sudo apt-get update 
```

2\. To actually upgrade and install the latest versions of packages that are already installed:&#x20;

```
sudo apt-get upgrade 
```

**Step 2: PHP and Apache Server Installation**&#x20;

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:&#x20;

1\. Apache installation:&#x20;

```
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:&#x20;

```
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:&#x20;

```
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. &#x20;

1\. By executing the following command, you'll install PHP, plus additional related packages:&#x20;

```
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:&#x20;

```
php –v 
```

**Step 3: Install MariaDB**&#x20;

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:&#x20;

```
sudo apt install -y mariadb-server mariadb-client 
```

### **Securing database installation**&#x20;

1\. Enter as the root user first, using the below command:&#x20;

```
sudo -i 
```

2\. Set a new password for the root user with the following command:&#x20;

```
passwd 
```

3\. Run the following command to protect the installation:&#x20;

```
mysql_secure_installation 
```

After the installation is finished, follow the instructions for setting up the privileges of the database:&#x20;

```
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.&#x20;

**Step 4: Database creation for Joomla**&#x20;

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:&#x20;

```
mysql -u root -p 
```

2\. Create a DB, user and password by using the following script:&#x20;

```
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](https://downloads.joomla.org/us/cms/joomla4/4-2-2) with the command below:&#x20;

```
wget https://downloads.joomla.org/cms/joomla4/4-2-2/Joomla_4-2-2-Stable-Full_Package.zip?format=zip 
```

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.&#x20;

2\. First, we need to install the unzip library, with the following command:&#x20;

```
sudo apt install zip unzip 
```

3\. For unzipping the package, run the following command:&#x20;

```
sudo unzip Joomla_4-2-2-Stable-Full_Package.zip -d /var/www/html/joomla 
```

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

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

**Step 6: Apache Configuration for Joomla**&#x20;

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:&#x20;

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

2\. Mention the script below in the configuration file created above:&#x20;

```
<VirtualHost *:80> 
     ServerAdmin admin@your_domain.com 
     DocumentRoot /var/www/html/joomla/ 
     ServerName your_domain.com 
     ServerAlias www.your_domain.com 
 
     <Directory /var/www/html/joomla/> 
          Options FollowSymlinks 
          AllowOverride All 
          Require all granted 
     </Directory> 
 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 
 
```

1. After saving and closing the file, run the following command to activate Joomla’s virtual host:&#x20;

```
a2ensite joomla.conf 
```

2. Apply the changes next by restarting the Apache server with the following command.:&#x20;

```
systemctl restart apache2 
```

Now, you need to access <http://your\\_domain.com> (\<your domain> will be your IP address) in your web browser.&#x20;

**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:&#x20;
2. For Joomla 4.2.2 administrator account, configure the name, username, password, and email address of the Super User.&#x20;

{% hint style="warning" %}
**Note:** The passwords must be 12 characters long at least.
{% endhint %}

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

<table data-header-hidden><thead><tr><th width="62"></th><th width="244"></th><th></th></tr></thead><tbody><tr><td> </td><td><strong>Database Configuration- Data fields</strong> </td><td><strong>Data to be filled out</strong> </td></tr><tr><td>1 </td><td>Database type </td><td>Select the installed database. In this tutorial we have used ‘MySQLi’ database.</td></tr><tr><td>2 </td><td>Enter host name </td><td>Enter ‘localhost’ or provided by your provider. </td></tr><tr><td>3 </td><td>Username </td><td>Enter the username, created in <strong>Step 4.b code script.</strong> </td></tr><tr><td>4 </td><td>Password  </td><td>Enter the password that is set in <strong>Step 4.b code script.</strong> </td></tr><tr><td>5 </td><td>Database name  </td><td>Enter the database name, created in <strong>Step 4.b code script.</strong></td></tr><tr><td>6 </td><td>Table prefix </td><td>Use unique randomly generated or your own table prefix for table distinction in the database. </td></tr><tr><td>7 </td><td>Connection Encryption </td><td>Enter the type of connection encryption while connecting with the server. Here, we have used ‘Default’. </td></tr></tbody></table>

After filling out the details, click on **Install Joomla.**&#x20;

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.&#x20;
2. Now, you will land on the login page, from where you can get started by entering your credentials.&#x20;

### Conclusion

Joomla 4.2.2 is now properly installed on Ubuntu 20.04. You may take a reference from the [official Joomla manual](https://docs.joomla.org/) for further details and queries on Joomla installation.                                                                                                                                &#x20;
