Aug 16, 2024 6 min read

How to Install Joomla with Apache on Ubuntu 22.04

Install Joomla with Apache on Ubuntu 22.04 with our step-by-step tutorial. It allows you to create, manage, and publish digital content easily.

Install Joomla with Apache on Ubuntu 22.04
Install Joomla with Apache on Ubuntu 22.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install Joomla with Apache on Ubuntu 22.04, let’s briefly understand – What is Joomla?

Joomla is a powerful and user-friendly open-source Content Management System (CMS) that allows you to create, manage, and publish digital content easily. It offers a wide range of themes, templates, and extensions to customize your website.

With its intuitive interface and robust features, Joomla is an ideal choice for building websites, blogs, or online stores without requiring advanced technical skills. Whether you are a beginner or an experienced developer, Joomla provides a flexible and SEO-friendly platform to showcase your online presence effectively.

In this tutorial, you will install Joomla with Apache on Ubuntu 22.04. We will also answer few FAQs related to Joomla Installation with Apache on Ubuntu 22.04.

Advantages of Joomla

  1. User-friendly interface: Joomla's intuitive dashboard makes website creation and management simple for users of all levels.
  2. Extensive customization: With a vast selection of themes and extensions, Joomla allows for personalized and feature-rich websites.
  3. Powerful content management: Easily publish, edit, and organize content with Joomla's efficient CMS capabilities.
  4. Active community support: Benefit from a thriving community of developers and users for troubleshooting and updates.
  5. SEO optimization: Joomla's built-in SEO tools ensure higher visibility and ranking on search engines.

Prerequisites to Install Joomla with Apache on Ubuntu 22.04

  • Create a public domain name.
  • Log in as a user with sudo privileges.
  • Install Apache.
  • Install SSL Certificate to your domain.

Step 1 - Creating a MySQL Database

1) Joomla supports multiple databases like MySQL, PostgresSQL and, MS SQL and can use them for storing articles, users, extensions, and categories.

You'll use MySQL for managing the database. If you have MySQL installed skip the following step, else type:

sudo apt-get update
sudo apt-get install mysql-server

2) After that, log in to your MySQL console.

sudo mysql

3)  Run the following SQL statement to create a database.

CREATE DATABASE joomla CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

4) After that, create a new MySQL user and grant privileges.

CREATE USER 'joomlauser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON joomla.* TO 'joomlauser'@'localhost';

5) You have successfully completed the database setup process. Now, you can exit the MySQL console by typing exit.

EXIT;

Step 2 - Installing PHP

PHP 7.2 is the default PHP version and is recommended for Joomla.

1) Install all the required PHP extensions using the following command:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2 php7.2-cli php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-intl php7.2-xml php7.2-gd  php7.2-zip php7.2-curl php7.2-xmlrpc php7.2-xmlrpc

2) After that, you need to set the recommended PHP options by editing the php.ini file. The sed command is here:

sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.2/apache2/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.2/apache2/php.ini
sudo sed -i "s/post_max_size = .*/post_max_size = 256M/" /etc/php/7.2/apache2/php.ini
sudo sed -i "s/output_buffering = .*/output_buffering = Off/" /etc/php/7.2/apache2/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php/7.2/apache2/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/apache2/php.ini

3) Now, restart Apache to load the newly installed PHP extensions.

sudo systemctl restart apache2

Step 3 - Download Joomla

At the time of writing this article, the latest version of Joomla is version 4.0.0.

1) Create a directory to hold the Joomla files and navigate to them.

sudo mkdir -p /var/www/example.com
cd /var/www/example.com

2) After that, download the latest version of Joomla from the Joomla downloads page using the following wget command:

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

3) After downloading, move the files into the domain’s document root directory using the following command.

sudo unzip Joomla_4-2-8-Stable-Full_Package.zip

4) Now, change the directory’s owner so that the web server can have full access to the site’s files and directories.

sudo chown -R www-data: /var/www/example.com

Step 4 - Configuring Apache

1) You should have Apache installed by now, with an SSL certificate installed on your system.

Now, you need to edit the Apache virtual hosts configuration using the following command:

sudo nano /etc/apache2/sites-available/example.com.conf

2) After that, replace example.com with your Joomla domain and set the correct path to the SSL certificate files.

                      /etc/apache2/sites-available/example.com.conf

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName example.com
  ServerAlias www.example.com

  Protocols h2 http:/1.1

  <If "%{HTTP_HOST} == 'www.example.com'">
    Redirect permanent / https://example.com/
  </If>

  DirectoryIndex index.html index.php
  DocumentRoot /var/www/example.com

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

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem

  <Directory /var/www/example.com>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

If you don't have SSL certificates, then use can use this conf:

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Protocols h2 http:/1.1

  DirectoryIndex index.html index.php
  DocumentRoot /var/www/example.com

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

  <Directory /var/www/example.com>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

3) If not enabled, enable your virtual host for the domain. The following command will create a symbolic link from the sites-available to the sites-enabled directory:

sudo a2ensite example.com

Remove/unlink the default Apache page:

sudo a2dissite 000-default

4) After that, restart the Apache for the new configuration to take effect.

sudo systemctl restart apache2

Step 5 - Complete the Joomla Installation

Now, the Joomla download process is complete, and you can finalize the installation process using the web interface.

1) Open your browser and enter your domain.

2) Select your preferable language and fill in the following information:

  • Site Name - Your new Joomla website name.
  • Superuser Email Address - Use a valid administrative user email address, if you forget your password it will send a password reset link to this email.  
  • Superuser Username - For security purposes, set your username to something else than "admin".
  • Superuser Password - Make sure to set a strong password.

3) Click on the "Next" button after you finish and enter your database connection details.

  • Database Type - Leave the default "MySQLi".
  • Hostname - Leave the default "localhost".
  • Username, Password, Database Name - Enter the MySQL user and database details that you have created.
  • Table Prefix - You can leave the prefix that is generated automatically.
  • Old Database Process - Select the default “Backup” option.

4) Click on the “Next” button and install sample data to verify that all checks are passed. After that, you need to click on the Install button and once the installation is complete it will take you to a page informing you that Joomla has been installed.

To install additional languages, click on the "Extra Steps: Install Languages" button.

5) After that, delete the installation directory for security purposes. Go back to the terminal and run the following command:

sudo rm -rf /var/www/example.com/installation

Click on the Administrator button to access the backend and start customizing your Joomla installation with new Themes and Plugins.

FAQs to Install Joomla with Apache on Ubuntu 22.04

What is the recommended method to install Joomla with Apache on Ubuntu 22.04?

The recommended method is to manually install Joomla by downloading and extracting the Joomla files from the official Joomla website, configuring Apache virtual host settings, and setting up a MySQL or MariaDB database for Joomla.

How can I install Apache web server on Ubuntu 22.04?

To install Apache on Ubuntu 22.04, open a terminal and run the following command: sudo apt update && sudo apt install apache2

Can I use Nginx instead of Apache with Joomla on Ubuntu 22.04? 

Yes, you can use Nginx instead of Apache with Joomla on Ubuntu 22.04. You will need to follow Nginx-specific configuration instructions provided by the Joomla documentation.

Does Joomla require a database server? 

Yes, Joomla requires a MySQL or MariaDB database server to store its data. You will need to install and configure a database server before installing Joomla.

How can I configure Apache virtual host settings for Joomla on Ubuntu 22.04?

To configure Apache virtual host settings for Joomla on Ubuntu 22.04, create a new virtual host configuration file in the /etc/apache2/sites-available/ directory and set up the appropriate settings for your Joomla installation, including the DocumentRoot and ServerName.

Can I use an existing database for Joomla installation on Ubuntu 22.04? 

Yes, you can use an existing MySQL or MariaDB database for Joomla installation. During the installation process, you will need to provide the database connection details for Joomla to utilize the existing database.

How can I access the Joomla web interface after installation on Ubuntu 22.04? 

By default, Joomla can be accessed by opening your web browser and entering the URL for your Joomla site, which is typically http://your_domain or http://localhost if installed locally.

Conclusion

We hope this tutorial helped you successfully install Joomla with Apache on your Ubuntu 22.04 server.  To learn more about Joomla, Joomla Documentation is a good place to start.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.