How to Install Joomla 4 on Debian 11

how to install joomla 4 on debian 11

In this tutorial, we are going to explain in step-by-step detail how to install Joomla 4 on Debian 11 OS.

Joomla is an open-source content management system (CMS) used for publishing web content on websites. Joomla CMS is written in PHP Symfony and is based on the MVC (Mode-View-Controller) web application framework. This software includes a lot of features such as page caching, blogs, language support, feeds, etc. In this tutorial, we are going to set up Joomla 4 with the most used stack, the LAMP stack.

Installing Joomla 4 with LAMP stack is a straightforward process that can take up to 15 minutes. Let’s get started!

Prerequisites

  • A server with Debian 11 as OS
  • User privileges: root or non-root user with sudo privileges
  • VPS with at least 1GB of RAM (Our SSD 1 VPS plan)

Step 1. Update the System

Before we start with the LAMP stack installation and Joomla 4 we need to update the system:

sudo apt update -y && sudo apt upgrade -y

Step 2. Install Apache Web Server

To install the Apache web server, execute the following command:

sudo apt install apache2 -y

Once installed, start and enable the service.

sudo systemctl enable apache2 && sudo systemctl start apache2

Check if the service is up and running:

sudo systemctl status apache2

You should receive the following output:

root@host:~# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-07-21 06:38:48 EDT; 11s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 1595 (apache2)
      Tasks: 55 (limit: 4678)
     Memory: 21.2M
        CPU: 100ms
     CGroup: /system.slice/apache2.service
             ├─1595 /usr/sbin/apache2 -k start
             ├─1600 /usr/sbin/apache2 -k start
             └─1601 /usr/sbin/apache2 -k start

Jul 21 06:38:48 host.test.vps systemd[1]: Starting The Apache HTTP Server...

Step 3. Install PHP8.1 with dependencies

First, we need to install some dependencies:

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https -y

Next, we need to add the PHP repository and key since they are not added in Debian 11 repository by default:

sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' 

wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -

Once these are added, update the repository again.

sudo apt update -y

To install the PHP8.1 along with extensions, execute the following command:

sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl libapache2-mod-php -y

Step 4. Install MariaDB database server

To install the MariaDB database server, execute the command below.

sudo apt install mariadb-server -y

Start and enable the mariadb.service with the following commands:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the mariadb.service

sudo systemctl status mariadb

You should receive the following output:

root@host:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.5.15 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-07-21 06:46:42 EDT; 13s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 14557 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 17 (limit: 4678)
     Memory: 66.9M
        CPU: 719ms
     CGroup: /system.slice/mariadb.service
             └─14557 /usr/sbin/mariadbd

To check the installed MariaDB database version, you can execute the following command:

mysql -V

You should receive the following output:

root@host:~# mysql -V
mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

Step 5. Create a Joomla database and user

To create a Joomla database user and Joomla database with permissions, execute the following command in the MySQL command line tool:

 CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
 CREATE DATABASE joomla;
 GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost';
 FLUSH PRIVILEGES;
 EXIT;

Step 6. Download and Install Joomla

We are going to download Joomla 4 installation in the default Apache document root directory:

cd /var/www/html

wget https://downloads.joomla.org/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.zip?format=zip

Once downloaded, extract the Joomla zip file.

unzip Joomla_4-1-5-Stable-Full_Package.zip?format=zip

Set the right permissions:

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

sudo chmod -R 755 /var/www/html/

Step 7. Create Apache Virtual Host for Joomla

In order can access the Joomla Web interface, we need to create a virtual host configuration file where we can define our domain, document root, and some script parameters.

First, create the configuration file with the following command:

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

Open the file, and paste the following lines of code:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/

<Directory /var/www/html>
AllowOverride All
</Directory>

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

</VirtualHost>

Enable the Apache2 configuration file and other modules:

sudo a2ensite joomla.conf

sudo a2enmod headers env rewrite

Check the syntax of the Apache2 configuration.

apachectl -t

You should receive the following output:

root@host:~# apachectl -t
Syntax OK

If you receive this output, you can safely restart the Apache service.

sudo systemctl restart apache2

Now, you can access the Joomla Web interface at http://YourDomain.com

install joomla on debian 11

Congratulations! You successfully installed and configured Joomla 4 on Debian 11. Now, you can finish your installation at http://YourDomain.com using the credentials you set up before. If you find installing and finishing this setup difficult, you can always contact our admins, who will do the rest for you. We are available 24/7. Always trust our epic support.

If you liked this post on how to install Joomla 4 on Debian 11, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Comment