Oct 17, 2023 6 min read

How to Install Joomla with Apache on Ubuntu 20.04

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

Install Joomla with Apache on Ubuntu 20.04
Table of Contents

Introduction

Before we begin talking about how to install Joomla with Apache on Ubuntu 20.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 20.04. We will also answer few FAQs related to Joomla Installation with Apache on Ubuntu 20.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 20.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 20.04

Are there any specific requirements for installing Joomla with Apache on Ubuntu 20.04?

Yes, you need to ensure that you have Apache, MySQL, and PHP installed on your Ubuntu 20.04 server. Additionally, you should check the official Joomla documentation for any specific version requirements.

How do I configure Apache to work with Joomla?

After installing Apache, you need to create a virtual host configuration file for your Joomla website, specifying the necessary settings such as the domain name, document root, and directory permissions.

What is the recommended PHP version for Joomla on Ubuntu 20.04?

Joomla recommends using PHP version 7.3 or higher. However, it is always a good idea to check the official Joomla documentation for the most up-to-date recommendations.

Do I need to create a MySQL database for Joomla?

Yes, before installing Joomla, you need to create a MySQL database where Joomla can store its data. This can be done using the MySQL command-line interface or a graphical tool like phpMyAdmin.

How do I secure my Joomla installation on Ubuntu 20.04?

You can enhance the security of your Joomla installation by keeping it up to date, using strong passwords, enabling SSL/TLS encryption, restricting file and directory permissions, and implementing regular backups.

Can I use a different database server instead of MySQL?

Yes, Joomla supports other database servers like PostgreSQL or SQLite. However, the installation steps and configuration might differ from using MySQL. Consult the official Joomla documentation for specific instructions.

Where can I find more information and documentation on installing and configuring Joomla with Apache on Ubuntu 20.04?

The official Joomla documentation provides comprehensive instructions and resources for installing and configuring Joomla with Apache on Ubuntu. Refer to the official Joomla documentation for more specific information and troubleshooting tips.

Conclusion

We hope this tutorial helped you successfully install Joomla with Apache on your Ubuntu 20.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 Blog - 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.