There is a new version of this tutorial available for Debian 12 (Bookworm).

How to Install Joomla with Apache and Let's Encrypt SSL on Debian 10

Joomla is a free and open-source content management system used to create, modify and manage the content of a website. It is simple and easy to use so you don't need to have any HTML or CSS knowledge to build the website. It is written in PHP and uses MySQL as a database. It offers a wide range of features that make it a flexible content management system right out of the box. It comes with hundreds of free extensions that allow you to customize and extend the functionality.

In this tutorial, I will show you how to install Joomla CMS with Apache and Let's Encrypt on Debian 10.

Prerequisites

  • A server running Debian 10.
  • A valid domain name pointed with your server IP.
  • A root password is configured the server.

Getting Started

First, update the system packages to the updated version by running the following command:

apt-get update -y

Once all the packages are updated, you can proceed to the next step.

Install LAMP Server

Next, you will need to install the Apache web server, MariaDB database, PHP and other PHP extensions to your system. You can install all of them with the following command:

apt-get install apache2 mariadb-server php openssl php-imagick php-common php-curl php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip -y

Once all the packages are installed, you can proceed to the next step.

Create a Database for Joomla

Joomla uses MySQL or MariaDB to store its content. So you will need to create a database and user for Joomla.

First, connect to the MariaDB with the following command:

mysql

Once connected, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE joomladb;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'password';

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

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

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

Install Joomla

Next, download the latest version of Joomla with the following command:

wget https://downloads.joomla.org/cms/joomla3/3-9-25/Joomla_3-9-25-Stable-Full_Package.tar.bz2

Once the download is completed, create a directory for Joomla inside the Apache web root:

mkdir /var/www/html/joomla

Next, run the following command to extract the downloaded file to the Joomla directory:

bunzip2 Joomla_3-9-25-Stable-Full_Package.tar.bz2
tar -xvf Joomla_3-9-25-Stable-Full_Package.tar -C /var/www/html/joomla/

Next, set proper permission and ownership to the Joomla directory with the following command:

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

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

Configure Apache Web Server

Next, you will need to create an Apache virtual host configuration file to host the Joomla.

You can create it with the following command:

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

Add the following lines:

<VirtualHost *:80>
   ServerName joomla.example.com 
   ServerAdmin [email protected]
   DocumentRoot /var/www/html/joomla
   <Directory /var/www/html/joomla>
	    Allowoverride all
   </Directory>
</VirtualHost>

Save and close the file then enable the Apache virtual host with the following command:

a2ensite joomla

Next, restart the Apache service to apply the changes:

systemctl restart apache2

Next, verify the status of the Apache with the following command:

systemctl status apache2

You should 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 Mon 2021-03-22 09:26:20 UTC; 4s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 14495 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 14499 (apache2)
    Tasks: 6 (limit: 4701)
   Memory: 18.8M
   CGroup: /system.slice/apache2.service
           ??14499 /usr/sbin/apache2 -k start
           ??14500 /usr/sbin/apache2 -k start
           ??14501 /usr/sbin/apache2 -k start
           ??14502 /usr/sbin/apache2 -k start
           ??14503 /usr/sbin/apache2 -k start
           ??14504 /usr/sbin/apache2 -k start

Mar 22 09:26:20 debian10 systemd[1]: Starting The Apache HTTP Server...

Access Joomla

Now, open your web browser and access the Joomla web interface using the URL http://joomla.example.com. You will be redirected to the following page:

Joomla installer

Now, provide your site name, email address, admin username, password, and click on the Next button. You should see the following page:

Database configuration

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

Finalize installation

Pre-installation check

Now, confirm all the settings and click on the Install button to start the installation. Once the installation has been completed, you should see the following page:

Joomla installed successfully

Click on the Remove installation folder. You should see the following page:

Remove installation folder

Now, click on the Administrator button, you should see the Joomla login page:

Joomla Login

Provide your Admin credentials and click on the Login button, you should see the Joomla Control Panel in the following image:

Joomla Admin Dashboard

Secure Joomla with Let's Encrypt SSL

It is always a good idea to secure your website with Let's Encrypt SSL. You will need to install the Certbot client to install and manage the SSL. You can install it with the following command:

apt-get install python3-certbot-apache -y

Once the Certbot is installed, run the following command to secure your website with Let's Encrypt SSL:

certbot --apache -d joomla.example.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): [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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.example.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.example.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.example.com/privkey.pem
   Your cert will expire on 2020-10-23. 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

Conclusion

Congratulations! you have successfully installed Joomla CMS on Debian 10 server. You can now build your own website easily using Joomla. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)