Joomla CMS is an open-source content management system for building websites and online applications. It offers user-friendly features and extensibility and is freely available to everyone. Powered by PHP, it can be used for multiple scenarios, such as forums, photo galleries, e-commerce, and various web-based applications.
In this guide, we’ll cover the installation of Joomla CMS on the Debian 12 server. You will install Joomla with the LAMP Stack (Apache, MariaDB, and PHP) and secure the installation with UFW (Uncomplicated Firewall) and SSL from Letsencrypt.
Prerequistes
Before delving into this guide, gather the following:
- A Debian 12 server.
- A non-root user with administrator privileges.
- A domain name pointed to the server IP address.
Installing Dependencies
Joomla is an open-source CMS based on PHP and MySQL databases. To install it, ensure the required dependencies are installed.
Now, you will install the LAMP Stack and additional dependencies, such as UFW and Certbot, that Joomla will use.
Run the apt command below to update the Debian repository.
sudo apt update
Now install Joomla dependencies using the apt command below. With this, you will install LAMP Stack packages, UFW, Certbot, and unzip utility.
sudo apt install apache2 mariadb-server php php-curl php-common php-json php-intl php-xml php-gd php-mysql php-imagick php-mbstring php-zip ufw certbot python3-certbot-apache unzip
Type Y and press ENTER to confirm the installation.
After the installation is finished, ensure both Apache2 and MariaDB is running and enabled on your Debian server.
Verify the apache2 service to ensure that the service is running and enabled using the command below.
sudo systemctl is-enabled apache2
sudo systemctl status apache2
Lastly, verify the mariadb service using the command below. You should get the mariadb service enabled with the status active (running).
sudo systemctl is-enabled mariadb
sudo systemctl status mariadb
Configuring UFW
In this example, you will run Joomla with UFW (Uncomplicated Firewall) running and enabled. In that case, be sure to add SSH, HTTP, and HTTPS ports to UFW.
First, run the command below to enable the application profile OpenSSH and ‘WWW Full‘. The OpenSSH profile will open the default SSH port 22, while the ‘WWW Full’ profile will open both HTTP and HTTPS ports – 80 and 443.
sudo ufw allow OpenSSH
sudo ufw allow 'WWW Full'
Then, enable UFW by executing the command below. Type y to confirm the process.
sudo ufw enable
You should get the message ‘Firewall is active and enabled on system startup‘, which confirms that UFW is running and enabled on your Debian machine.
Verify uFW using the following command. Be sure the OpenSSH and ‘WWW Full‘ profiles are available on your UFW-enabled rules.
sudo ufw status
Configuring PHP
After configuring UFW, the next step is to configure PHP for your Joomla installation.
Joomla required at least the following configurations on the php.ini file:
- memory_limit: 256M
- upload_max_filesize: 32M
- post_max_size: 32M
- max_execution_time: 30
Open the file ‘/etc/php/8.2/apache2/php.ini‘ using the nano editor command below.
sudo nano /etc/php/8.2/apache2/php.ini
Change the default php.ini configuration with the following. Be sure to adjust the memory_limit option with your current memory on your system.
memory_limit=512M
upload_max_filesize=64M
post_max_size=64M
max_execution_time=60output_buffering = Off
extension=intl
Save and close the file when you’re done.
Now run the command below to restart the apache2 service and apply your changes to PHP.
sudo systemctl restart apache2
Configuring MariaDB
In the following section, you will set up and secure the MariaDB server using the ‘mariadb-secure-installation‘ tool. Then, you will also create a new database and user for Joomla via MySQL/MariaDB client.
Start securing your MariaDB server installation by executing the ‘mariadb-server-installation‘ command below.
sudo mariadb-secure-installation
Input Y to implement the new configuration, or type N for ‘No’ to reject. Below are some of the MariaDB server configurations you will configure:
- The default MariaDB installation comes without a password, press ENTER when prompted for the password.
- Now input Y to set up the MariaDB root password. Then, type the new password for MariaDB and repeat the password.
- Input Y to remove the anonymous user from your MariaDB installation.
- Input Y again when prompted to disable the remote login for the MariaDB root user.
- Input Y to remove the default database test from your MariaDB.
- Lastly, input Y to reload table privileges and apply new changes.
Now that you’ve configured the MariaDB server, log in to MariaDB using the following command. Also, input your MariaDB root password when prompted.
sudo mariadb -u root -p
Run the following queries to create a new database joomladb with user joomla. Also, make sure to change the database password ‘p4ssword‘ with your strong password.
CREATE DATABASE joomladb;
CREATE USER joomla@localhost IDENTIFIED BY 'p4ssword';
GRANT ALL PRIVILEGES ON joomladb.* TO joomla@localhost;
FLUSH PRIVILEGES;
Next, run the following query to verify the privileges for the MariaDB user joomla@localhost.
SHOW GRANTS FOR joomla@localhost;
Ensure that the joomla@localhost user can access the database joomladb like the following.
Type quit to exit from the MariaDB server and move on to the next step.
Downloading Joomla CMS
In the following section, you will download the latest version of Joomla and set up proper permission and ownership of the Joomla source code.
At this time, the latest version of Joomla is v5.0.1. Be sure to check the Joomla download page and grab the latest version of it.
Move to the /var/www directory and download Joomlad using the wget command below.
cd /var/www/
wget https://downloads.joomla.org/cms/joomla5/5-0-1/Joomla_5-0-1-Stable-Full_Package.zip
Once downloaded, extract the Joomla source code to the joomla directory using the following unzip command. With this, your Joomla installation directory will be located at /var/www/joomla.
unzip Joomla_5-0-1-Stable-Full_Package.zip -d joomla
Now change the ownership of /var/www/joomla directory to the user www-data and group www-data.
sudo chown -R www-data:www-data /var/www/joomla
Setting Up Apache2 Virtual Host
In the following step, you will create a new Apache virtual host configuration to run Joomla. Be sure that you have a domain name ready and pointed to your server IP address. For example here, we’ll use hwdomain.io.
To start, run the following nano editor command to create a new virtual host configuration ‘/etc/apache2/sites-available/joomla.conf‘.
sudo nano /etc/apache2/sites-available/joomla.conf
Insert the following configuration and be sure to change the domain name hwdomain.io with your domain.
<VirtualHost *:80>ServerAdmin [email protected]
ServerName hwdomain.io
DocumentRoot /var/www/joomla<Directory /var/www/joomla/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>ErrorLog ${APACHE_LOG_DIR}/hwdomain.io_error.log
CustomLog ${APACHE_LOG_DIR}/hwdomain.io_access.log combined</VirtualHost>
Save the file and exit the editor, when finished.
Next, run the command below to activate the virtual host file joomla.conf and verify your Apache syntax.
sudo a2ensite joomla.conf
sudo apachectl configtest
If no error on your Apache syntax, you will see an output ‘Syntax OK‘.
Now apply the new virtual host file joomla.conf by restarting Apache2 using the following systemctl command.
sudo systemctl restart apache2
Securing Joomla with SSl/TLS Certificates
At this point, your Joomla installation is running. But, to ensure your Joomla installation is safe, you will implement HTTPS via Certbot and Letsencrypt.
In the first step, you’ve installed both the certbot and python3-certbot-apache plugin.
Now run the following certbot command to generate SSl/TLS certificates for your domain name. Be sure to change the details of the email address and the domain name with your information.
sudo certbot --apache --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d hwdomain.io
Once the process is finished, your Joomla installation should automatically configured with HTTPS. And your SSL certificates will be available at /etc/letsencrypt/live/yourdomain.com directory.
Installing Joomla via Web Installer
Open up your web browser and visit the domain name of your Joomla installation, such as (https://hwdomain.io/). You will be presented with the Joomla web installer page.
Select the default language, and input the site name of your Joomla installation. Then, click Setup Login Data to configure the Joomla administrator user.
Input your name, username, email address, and the password for Joomla administrator user. Then, click Setup Database Connection to continue.
Input the MariaDB server database name, user, host, and the default database prefix. Then, click Install Joomla to start the installation process.
During the installation, you will see the following:
Once the Joomla installation is finished, you should get the message ‘Congratulations! Your Joomla site is ready!‘.
From here, click the following:
- Open Site: Open the home page of your Joomla installation.
- Open Administrator: Open the Joomla administration URL, which is https://hwdomain.io/administrator.
Below is the screenshot of the default homepage of the Joomla installation.
Within the Joomla administrator login page, input the admin user and password for your Joomla installation, then click Log in to confirm.
If you have the correct admin user and password, you should get the Joomla administrator dashboard like the following:
Conclusion
Congratulations! You’ve completed the installation of Joomla open-source CMS on the Debian 12 server. You’ve installed Joomla with the LAMP Stack (Apache, MariaDB, and PHP), and also secured your Debian server with UFW (Uncomplicated Firewall), and secured your Joomla installation with SSL/TLS certificates from Letsencrypt.
To take a step further, why not choose some available themes and customize your Joomla homepage? Or, you can also try to install the Joomla plugin to add functionality to your Joomla site.