There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Install Joomla with Apache2 and Let's Encrypt on Ubuntu 20.04

Joomla is an open-source content management system used for publishing online applications and websites. It is written in PHP and uses MySQL/MariaDB as a database back-end. It is a simple, user-friendly and built on a mobile-ready model–view–controller web application framework. Joomla comes with a ton of features and designs that make it a good bet for building professional sites.

In this tutorial, we will show you how to install Joomla CMS with Apache and secure with Let's Encrypt SSL on Ubuntu 20.04.

Prerequisites

  • A server running Ubuntu 20.04 with 2 GB of RAM.
  • A valid domain name pointed with your server.
  • A root password is configured on your server.

Install LAMP Server

First, you will need to install the Apache webserver, MariaDB, PHP and other PHP extensions in your system. You can install them using the following command:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-json php7.4-opcache php7.4-mbstring php7.4-intl php7.4-xml php7.4-gd php7.4-zip php7.4-curl php7.4-xmlrpc unzip -y

Once all the packages are installed, edit the php.ini file and modify some settings.

nano /etc/php/7.4/apache2/php.ini

Change the following values:

memory_limit = 512M
upload_max_filesize = 256M
post_max_size = 256M
output_buffering = Off
max_execution_time = 300
date.timezone = Asia/Kolkata

Save and close the file once you are finished.

Create a Database

First, secure the MariaDB installation and set the MariaDB root password with the following command:

mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Next, log in to the MariaDB shell with the following command:

mysql -u root -p

Provide your MariaDB root password when prompt then create a database and user for Joomla with the following command:

MariaDB [(none)]> CREATE DATABASE joomladb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomla'@'localhost' IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Download and Install Joomla

First, download the latest version of the Joomla from its official website with the following command:

wget https://downloads.joomla.org/cms/joomla3/3-9-18/Joomla_3-9-18-Stable-Full_Package.zip

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

unzip Joomla_3-9-18-Stable-Full_Package.zip -d /var/www/html/joomla

Next, change the ownership of the joomla directory to www-data with the following command:

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

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

Configure Apache for Joomla

Next, create a new Apache virtual host configuration file to serve Joomla.

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

Add the following content:

<VirtualHost *:80>
  ServerName joomla.linuxbuz.com
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/joomla

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

  <Directory /var/www/html/joomla>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

Save and close the file then enable the Apache virtual host and restart the Apache service using the following command:

a2ensite joomla
systemctl restart apache2

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

Secure Joomla with Let's Encrypt SSL

First, you will need to install the Certbot client to install and manage the Let's Encrypt SSL. You can install it with the following command:

apt-get install certbot python3-certbot-apache -y

Once the Certbot is installed, run the following command to download and install Let's Encrypt SSL for your website:

certbot --apache -d joomla.linuxbuz.com

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

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
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

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.linuxbuz.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 finish the installation as shown below.

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.linuxbuz.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-08-19. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

At this point, your Joomla website is secured with Let's Encrypt SSL. You can now proceed to the next step.

Access Joomla CMS

Now, open your web browser and type the URL https://joomla.linuxbuz.com. You will be redirected to the Joomla web-based installation wizard:

Provide your sitename, admin email, password and click on the Next button. You should see the database configuration wizard:

Provide your Joomla database name, database username, password and click on the Next button. You should see the Joomla finalization page:

Select your desired option and click on the Install button. You should see the following page:

Review all the configurations and click on the Install button. Once the Joomla has been installed, you should see the following screen:

Now, remove the installation directory and click on the Administrator button. You should see the Joomla login page:

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

You can also access your Joomla website by visiting the URL https://joomla.linuxbuz.com. You should see your Joomla website in the following page:

Conclusion

Congratulations! you have successfully installed and secured Joomla with Let's Encrypt on Ubuntu 20.04. You can now easily build your eCommerce store, personal website, social site or blog. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)