Joomla is a free and open-source content management system (CMS) for creating dynamic websites. It is based on the Model-View-Controller framework for web applications and offers intuitive interfaces and a wide range of functions. Joomla is mainly written in the PHP programming language with GNU General Public License and also supports two different RDBMS (Relational Database Management System): MySQL/MariaDB and PostgreSQL.

Joomla is one of the most popular content management systems on the Internet. It is versatile: you can use Joomla for publishing web content, forums, photo galleries, e-commerce and numerous web applications. It supports multilingualism and SEO and has a great design and great features. Joomla is a very flexible CMS, extensible and customizable.

This guide will show you how to install Joomla CMS (Content Management System) with the LAMP stack (Linux, Apache2, MariaDB and PHP) on the Ubuntu 22.04 server. I will also show you how to set up the virtual Apache2 host for Joomla with SSL/HTTPS so that you end up with a secure Joomla CMS with SSL/HTTPS enabled.

Prerequisites

Before you start with this guide, you must fulfill the following requirements:

  • An Ubuntu 22.04 server.
  • A non-root user with root/administrator privileges.
  • A domain name that points to the IP address of the server.

Installation of the Apache2 web server

Joomla CMS can be operated under various web servers such as Apache2, Nginx or IIS (for Windows). This guide shows you how to run Joomla with the Apache2 web server. Now install the Apache2 web server on your Ubuntu system.

Run the following apt command to update and upgrade the Ubuntu repositories before installing the Apache2 packages.

sudo apt update

Now install the Apache2 web server with the following command. Enter Y to confirm the installation and press ENTER to start the installation.

sudo apt install apache2

How to Install Joomla on Ubuntu 22.04 linux ubuntu

After the Apache2 installation is complete, run the following command to check and verify the Apache2 service. On the Ubuntu system, Apache2 is automatically activated and running. So you should see that the Apache2 service is“enabled” and automatically running on boot. And the current status of the Apache2 service is “running”.

sudo systemctl is-enabled apache2
sudo systemctl status apache2

How to Install Joomla on Ubuntu 22.04 linux ubuntu

If you have the UFW firewall running on your Ubuntu system, you need to add the Apache2 rule ports to the firewall. The default installation of Apache2 comes with the UFW application rule.

Run the ufw command below to add the Apache2 service ports (80 and 443 – HTTP and HTTPS) to the UFW firewall.

sudo ufw allow "Apache2 Full"
sudo ufw reload

Now check the enabled firewall rule with the following command. You should see that the “Apache2 Full” application has been added to the UFWE firewall.

sudo ufw status

Installation of MariaDB Server

Joomla can be used with two different RDBMS (Relational Database Management System) like MySQL/MariaDB and PostgreSQL. In this guide, you will learn how to install Joomla with MariaDB as the default database. So it’s time to install the MariaDB database on your Ubuntu server.

Run the following apt command to install the MariaDB database server, which is available by default in the Ubuntu repository. Enter Y to confirm the installation and press ENTER to start the installation.

sudo apt install mariadb-server

How to Install Joomla on Ubuntu 22.04 linux ubuntu

After the MariaDB server installation is complete, run the following command to check and verify the MariaDB service. You should see that the MariaDB service is activated, i.e. it is automatically executed when booting. In addition, the current status of the MariaDB service is “running”.

sudo systemctl is-enabled mariadb
sudo systemctl status mariadb

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Next, you need to set up the MariaDB deployment on your server. You can use the command line“mysql_secure_installation” to set up and configure the MariaDB server with some basic security settings. This command is available by default on every MariaDB server installation.

Execute the“mysql_secure_installation” command as follows.

sudo mysql_secure_installation

Now you will be asked for some MariaDB server settings:

  • The default MariaDB installation comes without a password, so press ENTER to continue.
  • Enter“n” if you want to change the root authentication to unix_socket .
  • When you are asked if you want to change the root password, enter ” Y “. Then enter a new secure password for your MariaDB root user.
  • Enter Y to remove the default anonymous user from your MariaDB installation.
  • When asked if you want to disable/prevent remote login for the MariaDB root user, enter Y.
  • Now enter Y to remove the default database“test” from your installation.
  • Finally, enter Y again to reload all table permissions and apply the new changes.

This completes the installation and configuration of MariaDB.

Installing PHP 8.x

Now that you have installed the Apache2 web server and the MariaDB database, it’s time to install PHP. The latest version of Joomla requires at least PHPv7.2.5 with the recommended version of PHP 8.x. And the default repository of Ubuntu provides PHP 8.1 which is suitable for the latest version of Joomla installation.

Run the following apt command to install the PHP packages. Type Y to confirm the installation and press ENTER to continue and the PHP installation will begin.

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

How to Install Joomla on Ubuntu 22.04 linux ubuntu

After the PHP installation is complete, edit the configuration file“https://vitux.com/etc/php/8.1/apache2/php.ini” with the following command. Some additional configuration is required for the installation of Joomla CMS.

sudo nano /etc/php/8.*/apache2/php.ini

Change the default PHP settings with the following configurations.

memory_limit = 256M
upload_max_filesize = 80M
post_max_size = 120M
max_execution_time = 160

Save and close the file when you are done.

Finally, run the following command to restart the Apache2 service and apply the new changes.

sudo systemctl restart apache2

Create Joomla database and user

Before you start installing Joomla, you will also need to create a new MariaDB database and a new user for the Joomla installation.

Execute the following command to log in to the MariaDB shell. You will be asked for the MariaDB root password. Enter the correct password for the MariaDB root user.

sudo mysql -u root -p

Next, run the following queries to create a new MariaDB user and a new database for Joomla. In this demo, you will create the database“joomladb” with the user“joomla” and the password“yourpassword“. You can also change the details of the database configuration.

CREATE DATABASE joomladb;
CREATE USER joomla@localhost IDENTIFIED BY 'yourpassword';
GRANT ALL ON joomladb.* TO joomla@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Now run the following query to check and verify the permissions of the MariaDB user “joomla“. You should see that the user“joomla” has access to the database“joomldadb“.

SHOW GRANTS FOR joomla@localhost;
quit

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Downloading the Joomla source code

Once you have created the MariaDB database and user for Joomla, it’s time to download the Joomla source code to your server. At the time of this article, the latest version of Joomla v4.1.5 is stable and you will install it on the Ubuntu server.

Run the wget command below to download the Joomla source code. You will see the file“joomla.tar.bz2” in your current directory.

wget -O joomla.tar.bz https://downloads.joomla.org/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.tar.bz2

Now create a new directory “/var/www/joomla” and extract the Joomla source code into this directory by executing the following command. The directory“https://vitux.com/var/www/joomla” will be the default DocumentRoot for your Joomla installation.

mkdir -p /var/www/joomla
sudo tar -xjf joomla.tar.bz -C /var/www/joomla

Finally, use the following command to change the ownership and permissions for the Joomla DocumentRoot directory“https://vitux.com/var/www/joomla“. The owner should be the user “www-data” and the authorization is“755“.

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

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Setting up the virtual host for Joomla

Now you have completed the basic LAMP stack installation and created a new database and a new user for Joomla. You have also downloaded the Joomla source code to the“https://vitux.com/var/www/joomla” directory. Now you will set up the Apache2 s=virtual host configuration for Joomla.

Before you start editing the Apache2 conf files, run the following command to enable some Apache2 modules.

sudo a2enmod rewrite ssl headers deflate

Now create a new virtual host configuration“https://vitux.com/etc/apache2/sites-available/joomla.conf” with the following command.

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

Paste the following configuration into the file. You also need to change the default domain name and the path of the SSL certificates. In this example we use the domain“hwdomain.io“.

ServerName hwdomain.io
ServerAdmin [email protected]

# Redirect Requests to SSL
Redirect permanent "https://vitux.com/" "https://hwdomain.io/"

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







ServerName hwdomain.io
ServerAdmin [email protected]
DocumentRoot /var/www/joomla

# Add security
php_flag register_globals off

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

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/hwdomain.io/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hwdomain.io/privkey.pem


SSLOptions  StdEnvVars



Options None FollowSymLinks
#Allow .htaccess
AllowOverride All
Require all granted

SecRuleEngine Off
# or disable only problematic rules





Save and close the file when you’re done.

Next, run the following command to enable the“joomla.conf” virtual host configuration. Then check the Apache2 configuration. If your configuration is correct, you will see a message like“Syntax OK“. If you receive an error message, check the “joomla.conf” configuration file again.

sudo a2ensite joomla.conf
sudo apachectl configtest

Finally, execute the following command to restart the Apache2 service and apply the configuration of the virtual host “joomla.conf”.

sudo systemctl restart apache2

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Start Joomla installation

To start the Joomla installation, open the web browser and visit the Joomla domain (e.g. https://hwdomain.io). You should see the Joomla installation page.

Select the language for your Joomla installation. Then enter the site name for your Joomla and click on“Set up login data“.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Enter the new admin user, password and e-mail address for your Joomla installation and click on“Set up database connection“.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Select“MySQLi” as the database type. Then enter the database name, the user, the password and the database prefix. Finally, click on“Install Joomla“.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

After the Joomla installation is complete, you will see a message like “Congratulations! Your Joomla website is ready.”. Click on“Open page” to open the default homepage of your Joomla installation or click on“Open administrator” to visit the Joomla administrator login page.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

You will see the default Joomla home page as shown in the screenshot below.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

For the Joomla administrator login, you can go to the path URL“https://vitux.com/administrator” (i.e. https://hwdomain. io/administrator/). Enter the Joomla administrator user and password and then click on“Login“.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

If your admin user and password are correct, you will see the Joomla administrator dashboard as follows.

How to Install Joomla on Ubuntu 22.04 linux ubuntu

Conclusion

Congratulations! You have now successfully installed Joomla CMS with the LAMP stack on the Ubuntu 22.04 server. Now you have also secured your Joomla installation with the SSL/HTTPS connections. Now you may want to secure your Joomla installation by changing the default admin page or installing some plugins and themes to extend the features of Joomla.