How to install Joomla with Apache and encrypt SSL on Debian 10

How to install Joomla with Apache and encrypt SSL on Debian 10

Joomla is a free and open source content management system for creating, modifying and managing website content. It is simple and easy to use, so you don’t need to have any knowledge of HTML or CSS to build a website. It is written in PHP and uses MySQL as the database. It provides a wide range of features, making it immediately available and becoming a flexible content management system. It comes with hundreds of free extensions that allow you to customize and extend functions.

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

prerequisites

  • A server running Debian 10.
  • A valid domain name pointing to the server IP.
  • The root password is configured for the server.

getting Started

First, update the system software package to a newer version by running the following command:

apt-get update -y

After all packages have been updated, you can proceed to the next step.

Install LAMP server

Next, you will need to install Apache web server, MariaDB database, PHP and other PHP extensions on your system. You can install all components 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 packages are installed, you can proceed to the next step.

Create a database for Joomla

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

First, connect to MariaDB using the following command:

mysql

After connecting, use the following commands to create the database and user:

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

Next, refresh the privileges and exit from MariaDB using the following command:

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

Once completed, you can proceed to the next step.

Install Joomla

Next, use the following command to download the latest version of Joomla:

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

After the download is complete, create a directory for Joomla in the Apache network root directory:

mkdir /var/www/html/joomla

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

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

Next, use the following command to set proper permissions and ownership for the Joomla directory:

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

Once completed, 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 Joomla.

You can create it with the following command:

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

Add the following line:

<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 use the following command to enable the Apache virtual host:

a2ensite joomla

Next, restart the Apache service to apply the changes:

systemctl restart apache2

Next, use the following command to verify the status of Apache:

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

Visit Joomla

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

Now, provide your website name, email address, administrator username, password, and click Next Button. You should see the following page:

Database configuration

Provide your database name, database user name, password, and click Next Button. You should see the following page:

finish installation

Check before installation

Now, confirm all settings and click installation Button to start the installation. After the installation is complete, you will see the following page:

Joomla installed successfully

Click on Get rid of installation folder. You should see the following page:

Delete the installation folder

Now, click administration staff Button, you should see the Joomla login page:

Joomla login

Provide your administrator credentials and click log in Button, you should see “Joomla Control Panel” in the image below:

Joomla Management Console

Let’s encrypt SSL to protect Joomla

Using “Let’s Encrypt SSL” to protect your website is always a good idea. You will need to install the Certbot client to install and manage SSL. You can use the following command to install:

apt-get install python3-certbot-apache -y

Once Certbot is installed, run the following command to use “Let’s Encrypt SSL” to protect your website:

certbot --apache -d joomla.example.com

You will be asked to provide an email and accept the terms 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, choose whether 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 press Enter to install “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

in conclusion

Congratulations! You have successfully installed Joomla CMS on Debian 10 server. Now you can easily build your own website using Joomla. If you have any questions, please feel free to ask me.

Source

Related Posts