Install Joomla on Ubuntu 22.04

This article will take you through how to install Joomla on Ubuntu 22.04. Joomla is a free and open-source content management system (CMS) used to publish web content on websites. Discussion forums, photo galleries, e-Commerce and user communities, and many more web-based applications are examples of web content applications that can be created by Joomla. It is created by a group of volunteers with the assistance of Open Source Matters, Inc.’s organizational, financial, and legal resources.

How to Install Joomla on Ubuntu 22.04

For Joomla to work on your Ubuntu 22.04, you need to have a server up and running e.g. Apache, Nginx, Lighttpd, etc. In case you haven’t set it up will do it real quick below, otherwise, feel free to jump to Joomla installation.

Install Apache Web Server on Ubuntu 22.04

  • Run the command below to install Apache.
sudo apt install -y apache2 apache2-utils
  • After installation enable it to start on boot.
sudo systemctl enable apache2
  • Then start it.
sudo systemctl start apache2

Install MariaDB Database Server on Ubuntu 22.04

  • Install MariaDB by running the following command.
sudo apt install mariadb-server mariadb-client
  • Next, enable MariaDB to start on boot.
sudo systemctl enable mariadb
  • Then start MariaDB using the command below.
sudo systemctl start mariadb
  • Secure MariaDB.
sudo mysql_secure_installation

Sample output

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Install PHP8.1 on Ubuntu 22.04

  • Run the following commands to install PHP with commonly used extensions.
sudo apt install php8.1 libapache2-mod-php8.1 php8.1-fpm php8.1-mysql php-common php8.1-cli php8.1-common php8.1-opcache php8.1-readline php8.1-mbstring php8.1-xml php8.1-gd php8.1-curl
  • Activate the Apache PHP 8.1 module.
sudo a2enmod php8.1
  • Then restart Apache to apply changes.
sudo systemctl restart apache2

Create Joomla Database

  • Login to your MariaDB using the command below.
sudo mysql -u root -p
  • Create database.
CREATE DATABASE Joomla_db;
  • Create database user and password.
CREATE USER 'joomla_user'@'localhost' IDENTIFIED BY 'Joomla_password';
  • Give all database-created privileges to the user created.
GRANT ALL PRIVILEGES ON Joomla_db.* TO 'joomla_user'@'localhost';
  • Flush privileges.
FLUSH PRIVILEGES;
  • Exit MariaDB.
exit;

Sample output

Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 10.6.7-MariaDB-2ubuntu1 Ubuntu 22.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE Joomla_db;;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE USER 'joomla_user'@'localhost' IDENTIFIED BY 'Joomla_password';
Query OK, 0 rows affected (0.040 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON Joomla_db.* TO 'joomla_user'@'localhost';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye

Install Joomla on Ubuntu 22.04

wget https://downloads.joomla.org/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.zip?format=zip
  • Next, create a Joomla directory inside /var/www/html/ using the command below.
sudo mkdir /var/www/html/joomla
  • Then unzip Joomla to the directory created above.
sudo unzip Joomla_4-1-5-Stable-Full_Package.zip?format=zip -d /var/www/html/joomla
  • Give permission to Apache using the command below.
sudo chown -R www-data:www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla

Joomla Apache virtual host configuration

  • Create Apache virtual host configuration file using the command below.
sudo nano /etc/apache2/sites-available/joomla.con

Paste the configuration settings below to the file created above.

<VirtualHost *:80>  ServerAdmin [email protected]
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>

Save(ctrl+s) and exit(ctrl+x) the file.

  • Next, disable the default Apache site using the following command.
sudo a2dissite 000-default.conf
  • Then enable created site.
sudo a2ensite joomla.conf
  • Allow port 80 on your firewall.
sudo ufw allow 80/tcp
  • Restart your Apache server to apply changes.
sudo systemctl restart apache2

Access Joomla on Ubuntu 22.04

  • Open your preferred browser and enter your server IP or domain name. Select your language and site name.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • Next, enter your login details.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • Enter your database detail.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • If the details you provided are correct you should be able to see the page below.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • When opening the administrator, you will be required to enter the username and password created above.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • Administrator dashboard.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • Sample site.
Install Joomla on Ubuntu 22.04
Install Joomla on Ubuntu 22.04
  • That marks the end of our article, Cheers! We have gone through how to install Joomla on Ubuntu 22.04.

Read more on Joomla Documentation

Other Tutorials

Install WordPress with LEMP Stack on Ubuntu 22.04

Install WordPress with LAMP Stack on Ubuntu 22.04

Install WordPress with Apache on OpenSUSE

System administrator | Software Developer | DevOps

Leave a Comment