How To Install Joomla on Ubuntu 22.04

In this tutorial, we want to teach you How To Install and Configure Joomla on Ubuntu 22.04. Also, you will learn to Secure your Joomla on Ubuntu 22.04.

Joomla is a content management tool that allows users to create and maintain a web-based application or a website with the use of GUI operations and without writing the codes. This is an extensively used choice, as it is available as open-source, and the user doesn’t need to have programming knowledge or experience. One can easily work on their own website while connecting the backend with databases like MySQL and PostgreSQL.

Steps To Install and Configure Joomla on Ubuntu 22.04

To complete this guide, you need some requirements.

Requirements

First, you must log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.

Then, you must install LAMP Stack on your server. To do this, you can check this guide on How To Install LAMP Stack on Ubuntu 22.04.

Also, you need a domain name that is pointed to your server’s IP address.

Now follow the steps below.

Create a Database for Joomla on Ubuntu 22.04

At this point, you need to create a database for Joomla. To do this, log in to your MariaDB shell by using the command below:

sudo mysql -u root -p

From your MariaDB shell, run the following command to create a Joomla database on Ubuntu 22.04, here we named it joomla_db:

MariaDB [(none)]> CREATE DATABASE joomla_db;

Now you need to create a Joomla user and grant all the privileges to it, here we named it joomla_user:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON joomla_db.* TO 'joomla_user'@'localhost' IDENTIFIED BY 'password';

Flush the privileges and exit from your MariaDB shell:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Configure PHP for Joomla on Ubuntu 22.04

At this point, you need to install some PHP extensions on your server with the following command:

sudo apt install 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

Then, you need to make some configuration changes to your php.ini file. Open the file with your favorite text editor, here we use vi:

sudo vi /etc/php/8.1/fpm/php.ini

Find the line below and change their value as shown below:

memory_limit = 512M
upload_max_filesize = 256M
post_max_size = 256M 
max_execution_time = 300
date.timezone = America/New_York

Remember to put your current time zone in the file.

When you are done, save and close the file.

Install Joomla on Ubuntu 22.04

Now you need to visit the Joomla Downloads Page and get the Full zip package of the latest version of Joomla.

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

When your download is completed, unzip your downloaded file in the /var/www/html/joomla directory with the command below:

sudo unzip Joomla_4-2-5-Stable-Full_Package.zip?format=zip -d /var/www/html/joomla

Then, set the correct permissions and ownership to your Joomla directory:

# sudo chown -R www-data:www-data /var/www/html/joomla
# sudo chmod -R 755 /var/www/html/joomla

Create a Virtual Host file for Joomla

At this point, you need to configure the Apache webserver to serve Joomla web pages. To do this, create a virtual host file for Joomla with your favorite text editor, here we use vi:

sudo vi /etc/apache2/sites-available/joomla.conf

Add the following contents to the file:

Use the server’s Fully Qualified Domain Name (FQDN).

<VirtualHost *:80>
 ServerAdmin [email protected]
 DocumentRoot /var/www/html/joomla/
 ServerName example.com
 ServerAlias www.example.com

 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

 <Directory /var/www/html/joomla/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
 </Directory>
</VirtualHost>

When you are done, save and close the file.

Then, disable the default page by using the following command:

sudo a2dissite 000-default.conf

Next, enable the Joomla virtual host file on Ubuntu 22.04 with the following command:

sudo a2ensite joomla.conf
sudo a2enmod rewrite

Restart Apache to apply the changes:

sudo systemctl restart apache2

Also, don’t forget to open port 80 through the firewall:

sudo ufw allow 80/tcp

Access Joomla Web Interface

At this point, you can continue your Joomla installation on Ubuntu through the web interface.

Enter your server’s IP address or domain name in your web browser:

http://server-ip or domain.com

You will see your Joomla installer. Select your desired language and enter your Joomla site name and click Set up login data.

Choose Site name for joomla

Next, you need to enter your login data and click Setup database connection.

Choose Joomla super user

Next, enter the database credentials that you have provided before on Ubuntu 22.04 and click Install Joomla.

Joomla database Ubuntu 22.04

When your installation is completed, you will see the following screen. Click Open Administrator.

Joomla open administrator

Then, enter your Joomla super username and password and click Login.

Joomla login page

At this point, you will see your Joomla dashboard.

Joomla Ubuntu 22 dashboard

From here, you can create and customize your blog or website using various themes and plugins to your preference.

Secure Joomla on Ubuntu 22.04

At this point, we want to secure Joomla by getting the SSL certificates from Let’s Encrypt.

First, install snapd by using the command below:

sudo apt install snapd

Then, use the following command to install certbot on Ubuntu 22.04:

# sudo snap install core; sudo snap refresh core
# sudo snap install --classic certbot
# sudo ln -s /snap/bin/certbot /usr/bin/certbot

Now use the following command to get your SSL certificates:

sudo certbot --apache

You will be asked some questions, answer them and you will get the following output:

Output
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/example.com/privkey.pem
This certificate expires on 2023-02-17.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for example.com to /etc/apache2/sites-available/joomla-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://example.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The Certbot will take care of your renewal automatically before they expire. To do this, run the command below:

sudo certbot renew --dry-run
Output
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
  /etc/letsencrypt/live/example.com/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

At this point, you can reload the page on the browser and it should then redirect and load the HTTPS site https://example.com.

Conclusion

At this point, you have learned to Install and Configure Joomla on Ubuntu 22.04. Also, you will learn to Secure Joomla by getting SSL certificates from Let’s Encrypt on Ubuntu 22.04.

Hope you enjoy it.

You may be like these articles:

How To Install and Configure Joomla on AlmaLinux 8

How To Install and Configure Joomla On Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!