How to Install Joomla Server on Ubuntu 20.04 (Setup Tutorial)

How to Install Joomla Server on Ubuntu 20.04 step by step tutorial.  Joomla is a free, open source and one of the most popular content management system around the world. It is written in PHP and uses MySQL vs MariaDB as a database backend. It offers many features and thousands of plugins and templates or themes that help you to customize Joomla and extend its functionality. Joomla allows you to host different kinds of websites, blogs, and applications on the internet.

Joomla Features

  • Provides a lot of free and paid extensions and templates.
  • Supports a large community of developers, designers, etc.
  • Supports over 70 languages.
  • Used by 2 million websites around the world.
  • Supports two-factor authentication and advanced access control features.

In this post, we will explain how to install the Joomla server on Ubuntu 20.04.

Install Apache, MariaDB, and PHP

First, you will require a web server to host the Joomla on the internet. You can install the Apache webserver with MariaDB database server using the following command:

				
					apt-get install apache2 mariadb-server -y
				
			

After installing both packages, run the following command to install PHP and other necessary PHP extensions:

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

After the installation, verify the PHP version with the following command:

				
					php -v
				
			

You will get the following output:

				
					PHP 7.4.3 (cli) (built: Nov 25 2021 23:16:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
				
			

Next, edit the php.ini file and change some default settings:

				
					nano /etc/php/7.4/cli/php.ini
				
			

Change the following values:

				
					memory_limit = 256M
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
output_buffering = Off
date.timezone = UTC

				
			

Save and close the file then start the Apache and MariaDB service with the following command:

				
					systemctl start apache2
systemctl start mariadb
				
			

Configure MariaDB Database

By default, the MariaDB database is not secured. So it is recommended to secure it by running the mysql_secure_installation script:

				
					mysql_secure_installation
				
			

Answer all the questions to set a MariaDB root password and secure the installation:

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

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!

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, connect to the MariaDB shell with the following command:

				
					mysql -u root -p
				
			

Once you are connected, create a database and user for Joomla with the following command:

				
					create database joomladb;
create user joomlauser@localhost identified by 'joomlapassword';

				
			

Next, grant all the privileges to Joomla database with the following command:

				
					grant all on joomladb.* to joomlauser@localhost with grant option;
				
			

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

				
					flush privileges;
quit;
				
			

Download Joomla

First, go to the Joomla website and download the Joomla stable version with the following command:

				
					wget https://downloads.joomla.org/cms/joomla4/4-0-3/Joomla_4-0-3-Stable-Full_Package.tar.gz?format=gz -O Joomla_4-0-3-Stable-Full_Package.tar.gz
				
			

Once the download is completed, create a directory for Joomla and extract the downloaded file to the Joomla directory:

				
					mkdir /var/www/html/joomla
tar -xvzf Joomla_4-0-3-Stable-Full_Package.tar.gz -C /var/www/html/joomla --strip-components=1
				
			

Next, change the ownership and permission of the Joomla directory:

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

Create an Apache Virtual Host for Joomla

Next, you will need to create an Apache virtual host configuration file for Joomla. You can create it using the following command:

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

Add the following lines:

				
					<VirtualHost *:80>
     ServerAdmin admin@exampledomain.com
     DocumentRoot /var/www/html/joomla/
     ServerName joomla.exampledomain.com

     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 verify the Apache for any syntax error with the following command:

				
					apachectl -t
				
			

You will get the following output:

				
					Syntax OK
				
			

Next, activate the Joomla virtual host with the following command:

				
					a2ensite joomla.conf
				
			

Finally, restart the Apache service to apply the changes:

				
					systemctl restart apache2
				
			

You can check the status of the Apache using the command given below:

				
					systemctl status apache2
				
			

You will get the following output:

				
					● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-01-05 15:21:20 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15707 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15722 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 13.3M
     CGroup: /system.slice/apache2.service
             ├─15722 /usr/sbin/apache2 -k start
             ├─15723 /usr/sbin/apache2 -k start
             ├─15724 /usr/sbin/apache2 -k start
             ├─15725 /usr/sbin/apache2 -k start
             ├─15726 /usr/sbin/apache2 -k start
             └─15727 /usr/sbin/apache2 -k start

Jan 05 15:21:20 joomla systemd[1]: Starting The Apache HTTP Server...
				
			

Access Joomla Web Installer

Now, open your web browser and access the Joomla web installer using the URL http://joomla.exampledomain.com. You will get the following screen:

Select your language, provide your site name and click on the Setup Login Data. You will get the following screen:

Provide your Joomla admin username, password, email address and click on the Setup Databa Connection. You will get the following screen:

Provide your database credentials and click on the Install Joomla. Once the Joomla has been installed, you will get the following screen:

Click on the Complete & Open Admin. You will get the Joomla login screen:

Provide your Joomla admin user, password and click on the Log in. You will get the Joomla dashboard in the following screen:

Enable SSL on Joomla Website

Next, it is recommended to install the Let’s Encrypt SSL on the Joomla website. You can install the Certbot Let’s Encrypt client package using the following command:

				
					apt-get install python3-certbot-apache -y
				
			

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

				
					certbot --apache -d joomla.exampledomain.com
				
			

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

				
					Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): hitjethva@gmail.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.exampledomain.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 install the Let’s Encrypt SSL for your website:

				
					Enabled Apache rewrite module
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.exampledomain.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.exampledomain.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/open.exampledomain.com/privkey.pem
   Your cert will expire on 2022-04-11. 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"
 - 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
				
			

Now, you can access your Joomla website securely using the URL https://joomla.exampledomain.com.

How to Install Joomla Server on Ubuntu 20.04 Conclusion

In the above guide, we explained how to install Joomla with Apache on Ubuntu 20.04. We also explained how to enable SSL on the Joomla website using Let’s Encrypt. I hope this will help you to deploy Joomla in the production environment.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x