Joomla is a free, open-source, and award-winning content management system that allows you to build websites and online web applications. It is written in PHP and uses MySQL as a database backend. Joomla offers some excellent features that help users organize and manage content efficiently. It is extensible, easy to use, search engine friendly, and provides a user-friendly web interface to manage your website from the central place.

In this post, we will show you how to install Joomla CMS with Apache and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name pointed with your server IP.
  • A root password is configured on the server.

Install LAMP Server

First, install the Apache web server, MySQL database server, and the latest version of PHP with other extensions using the following command:

apt install apache2 mysql-server php8.1 libapache2-mod-php8.1 php8.1-dev php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml unzip -y

Once all the packages are installed, verify the PHP version using the following command:

php -v

You should see the following output:

PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Once you are finished, you can proceed to the next step.

Create a MySQL Database for Joomla

Next, you will need to create a database and user for Joomla to store the web content. First, connect to the MySQL with the following command:

mysql

Once you are connected, create a database and user with the following command:

mysql> CREATE DATABASE joomladb;

mysql> CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'securepassword';

Next, grant all the privileges to the Joomla database with the following command:

mysql> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost';

Next, flush the privileges table and exit from the MySQL using the following command:

mysql> FLUSH PRIVILEGES;

mysql> EXIT;

Once your are finished, you can proceed to the next step.

Download Joomla

At the time of writing this tutorial, the latest version of Joomla is 4.2.1. You can download it from its official website with the following command:

wget https://downloads.joomla.org/cms/joomla4/4-1-2/Joomla_4-1-2-Stable-Full_Package.zip

Once the download is completed, unzip the downloaded file to the Apache web root directory using the following command:

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

Next, change the ownership and permission of Joomla with the following command:

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

chmod -R 755 /var/www/html/joomla/

Once you are finished, you can proceed to the next step.

Create an Apache Virtual Host for Joomla

Next, you will need to create an Apache virtual host configuration file for Joomla. You can create it with the following command:

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

Add the following lines:


ServerAdmin [email protected]

ServerName joomla.example.com
DocumentRoot /var/www/html/joomla


        Options FollowSymlinks
        AllowOverride All
        Require all granted


ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined


Save and close the file then activate the Joomla virtual host with the following command:

a2ensite joomla.conf

Next, restart the Apache service to apply the changes:

systemctl restart apache2

You can also check the Apache service status with the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-04-29 07:59:59 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16393 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 16398 (apache2)
      Tasks: 6 (limit: 4630)
     Memory: 13.8M
        CPU: 129ms
     CGroup: /system.slice/apache2.service
             ??16398 /usr/sbin/apache2 -k start
             ??16399 /usr/sbin/apache2 -k start
             ??16400 /usr/sbin/apache2 -k start
             ??16401 /usr/sbin/apache2 -k start
             ??16402 /usr/sbin/apache2 -k start
             ??16403 /usr/sbin/apache2 -k start

Apr 29 07:59:59 ubuntu systemd[1]: Starting The Apache HTTP Server...

Once you are completed, you can proceed to the next step.

Access Joomla Web Installation

Now, open your web browser and access the Joomla web installation using the URL http://joomla.example.com. You will be redirected to the following page:

<img alt="Choose language" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p1.png62d5576e91f4c.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="300" loading="lazy" src="data:image/svg xml,” width=”750″>

Select your language, define your site name and click on the Setup Login Data. You should see the following page:

<img alt="Login to Joomla" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p2.png62d5576eaab31.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="337" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide your real name, username, password, email address, and click on the Setup Database Connection. You should see the following page:

<img alt="Database configuration" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p3.png62d5576ec2ae5.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="579" loading="lazy" src="data:image/svg xml,” width=”626″>

Provide your database name, database username, host, password, and click on the Install Joomla button. Once the Joomla is installed, you will get the following page:

<img alt="Joomla installation finished successfully" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p4.png62d5576ed5c06.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="407" loading="lazy" src="data:image/svg xml,” width=”750″>

Click on the Open Administrator. You should see the Joomla login page:

<img alt="Login as administrator" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p5.png62d5576f1dcaa.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="370" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide your admin username, password and click on the Log in button. You should see the Joomla dashboard on the following page:

<img alt="Joomla dashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/07/echo/p6.png62d5576f4fafe.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="373" loading="lazy" src="data:image/svg xml,” width=”750″>

Secure Joomla with Let’s Encrypt SSL

It is always a good idea to secure your website with Let’s Encrypt SSL. You will need to install the Certbot client to install and manage the SSL. You can install it with the following command:

apt-get install python3-certbot-apache -y

Once the Certbot is installed, run the following command to secure your website with Let’s Encrypt SSL:

certbot --apache -d joomla.example.com

You will be asked to provide your email and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/joomla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/joomla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/joomla-le-ssl.conf

Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to install the Let’s Encrypt SSL for your website:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/joomla.conf to ssl vhost in /etc/apache2/sites-available/joomla-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://joomla.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=joomla.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.example.com/privkey.pem
   Your cert will expire on 2023-01-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - 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

Now, you can access your website securely using the URL https://joomla.example.com.

Conclusion

Congratulations! you have successfully installed Joomla with Apache and Let’s Encrypt SSL on Ubuntu 22.04. You can now easily create and host a website using the Joomla platform. Feel free to ask me if you have any questions.