In this guide, we’ll show you how to install and configure the latest version of Joomla! Content Management System on Debian 9 – codename Stretch. Joomla! is a highly customizable multip purpose Open-Source Content Management System written in PHP which can be used for blogs, personal websites and corporate internet sites. Joomla!


  • Debian 9 installed on a bare-metal machine or on a virtual private server.
  • root access to the server (or an account with sudo privileges).
  • A domain name, private or public, depending on your deployment, with the proper DNS records configured for web services. If don’t have a valid or a registered domain name you can perform the installation and access the website via server’s IP address

Prepare the server

In the first step, update your system repositories and software packages by issuing the below commands.

apt update
apt upgrade

Then execute the following command in order to install some command line utilities that we will use during setup.

apt install wget bash-completion unzip net-tools

Set up the name for your system by executing the following command. Replace the word ‘joomla’ with your hostname.

hostnamectl set-hostname joomla

Finally, reboot the server in order to apply kernel updates and the hostname changes properly.


Install Apache and PHP

Joomla! is written mostly in PHP server-side programming language. In order to execute Joomla PHP scripts, a web server, such as Apache HTTP server, and a PHP processing gateway must be installed and made operational in the system. In order to install Apache web server and the PHP interpreter alongside with all required PHP modules needed by Joomla, issue the following command in your server console.

apt install apache2 libapache2-mod-php7.0 php7.0 php7.0-xml php7.0-mcrypt php7.0-opcache php7.0-mbstring php7.0-json php7.0-zip -y

After Apache and PHP have been installed, test if the web server is up and running and listening for network connections on port 80 by issuing the following command with root privileges.

netstat –tlpn

Check if Apache web server listens on port 80

Enable the Apache rewrite module with this command.

a2enmod rewrite

Configure SSL in Apache

In order to access Joomla! securely via HTTPS protocol, issue the following command to enable the SSL module and SSL site configuration file.

a2enmod ssl
a2ensite default-ssl.conf

Next, open Apache default SSL site configuration file with a text editor and enable URL rewrite rules by adding the following lines of code after DocumentRoot directive, as shown in the sample below:

nano /etc/apache2/sites-enabled/default-ssl.conf

SSL site configuration file excerpt:

<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted

Also, make the following change to VirtualHost line to look like shown in the below excerpt:

<VirtualHost *:443>

Apache SSL configuration

Close the Apache SSL configuration file and open the /etc/apache2/sites-enabled/000-default.conf file for editing.

nano /etc/apache2/sites-enabled/000-default.conf

Add the same URL rewrite rules that you’ve added in the SSL configuration file. Insert the lines after DocumentRoot statement as shown in the below example.

<Directory /var/www/html>
  Options +FollowSymlinks
  AllowOverride All
  Require all granted

Apache default configuration file

Finally, restart Apache daemon to apply the changes and visit your domain via HTTPS protocol.

systemctl restart apache2

Because you’re using the automatically generated Self-Signed certificates pair issued by Apache at installation, an error warning should be displayed in the browser, as shown in the screenshot below.


SSL security warning shown in Browser

Accept the warning in order to continue and you will be redirected to Apache default web page for debian via HTTPS, as shown in the image below.

Apache default page

Configure PHP 7

In this step, we need to make some further changes to the PHP configuration file in order to assure that the following PHP variables have the right values and the PHP timezone setting is correctly configured and matches your system geographical location.

Open the /etc/php/7.0/apache2/php.ini file for editing. Also, initially, make a backup of PHP configuration file.

cp /etc/php/7.0/apache2/php.ini{,.backup}
nano /etc/php/7.0/apache2/php.ini

Search, edit, and change the following variables in php.ini configuration file:

file_uploads = On
memory_limit = 256M
upload_max_file_size = 128M
zlib.output_compression = Off
output buffering = Off
date.timezone = Europe/London

Increase the memory_limit variable to support large file attachments and replace the date.timezone variable according to your physical timezone. Consult the list of time zones provided by PHP docs at the following link

If you want to increase the speed of your website pages via OPCache plugin available for PHP 7, append the following OPCache settings at the bottom of the php.ini file:


Close the php.ini configuration file. Restart the apache daemon to apply the changes:

systemctl restart apache2

Install MariaDB Database

Joomla! CMS stores its data in a database. In this guide, we’ll configure Joomla to use MariaDB database as backend. Issue the below command to install MariaDB and the PHP module needed to access the database.

apt install mariadb-server php7.0-mysql mariadb-client

Log in to the MySQL console and secure MariaDB root account by issuing the following commands.

mysql -h localhost

use mysql;
update user set plugin='' where user='root';
flush privileges;

Secure MariaDB by executing the script mysql_secure_installation program. The script will ask a series of questions designed to secure the MariaDB database, such as: to change MySQL root password, to remove anonymous users, to disable remote root logins and delete the test database.

sudo mysql_secure_installation

In order to log into MariaDB to secure it, we'll need the current

password for the root user. If you've just installed MariaDB, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y

... Success!

By default, MariaDB comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y

... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

Next, log into the MariaDB database console, create a database and database user for Joomla.

mysql –u root -p

create database joomla_db;
grant all privileges on joomla_db.* to 'joomla_user'@'localhost' identified by 'joomla_pass';
flush privileges;

Replace the word joomla_pass in the above SQL commands with a secure password of your choice.

Create Database and Database user

Install Joomla! CMS

After all system requirements are met, we can deploy Joomla. Visit the Joomla! download page at and grab the latest zip package by issuing the wget utility, as illustrated in the following sample.

cd /tmp

After the zip archive download finishes, extract Joomla zip archive directly to your web server document root path by issuing the below command. Remove the default index.html file first.

rm /var/www/html/index.html
unzip -d /var/www/html/

Execute the command below in order to change the ownership of the Joomla files to the Apache www-data user.

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

Now, start Joomla installation process by opening a browser and navigate to your server IP address or domain name via HTTPS protocol to the /installation directory.


On the first installation screen, Joomla installer will present the main configuration. First, select the language of your CMS. Then, provide a name for your website and a description for your site. On the right side, add an e-mail address that will be used by the website superuser account, a username for the superuser account and set up a strong password. Then, make sure the site offline switch button is set to No. This option assures that your website will be online after the installation process completed. Use the below screenshot as a guide to set up this stage of the installation. Finally, hit on Next button to move to the next stage of the installation process.

Joomla main configuration

On the next installation screen, choose MySQLi database type and specify MySQL database host address, the name of the database and user credentials created earlier for accessing Joomla database. You can leave the database table prefix as default random generated or create your own table prefix.

If you have an existing Joomla! installation with the same table prefix, you can choose backup the database tables or delete all existing tables. Finally, hit on the Next button to complete this step and continue the installation process, as shown in the below screenshot.

Joomla database setup

On the next installation screen, you can choose to install a Joomla! Sample data from the provided samples. Select None in case you want to create a basic empty website. You can also choose to send your Joomla! Configurations settings to the e-mail address supplied earlier for your superuser account. Finally, scroll down and review website main configuration, MySQL database configuration and if all PHP extensions, modules, and settings required by Joomla are passed. Use the below screenshots as a guide to complete this installation step. When you finish reviewing all installation checks and recommended settings, hit on Install button to start the installation process of Joomla!

Verify configuration

Configuration overview

After the installation process completed, the installer will inform you that Joomla! CMS has been successfully installed. You should delete the installation directory from your domain webroot now. You can use Extra steps button in order to install a new language required by Joomla to operate as a multilingual website.

Install additional languagesOn the language installation screen, select the languages you want to install in Joomla from the provided list and hit the Next button to continue.

Select languages to be installed

On the next screen, switch Activate the multilingual feature, Install localized content and Enable the language code plugin to YES. Select the default administrator and default site language and hit on Next button in order to complete languages installation and configurations step, as shown in the below image.

Enable multi-language support

Finally, after all the language settings are applied, click on the Remove installation folder button to delete the installer directory and finalize the installation process. You can use the below buttons to navigate to your website frontend or to the administrative panel of Joomla!

Joomla installation finished

In order to access the frontend website, navigate directly to your server’s IP address or domain name. The home page of your website should appear as shown in the below screenshot. This is the web page that visitors should hit regularly when accessing your domain name.

Joomla Frontend

In order to access Joomla! Admin panel, type the following address in your browser. Replace the domain name or IP address accordingly.


Login to Joomla! admin panel with the username and the password that you have choosen for the superuser account during the installation process, as illustrated in the below screenshot.

Login to Joomla backend

At the first, log in to Joomla backend panel as admin, a message will be displayed which will ask you whether you would like to grant your permission to Joomla to collect some basic statistics about the installed CMS platform. Choose whatever answer is best suited for you.

Joomla admin dashboard

In order to force visitors to browse the Joomla website and backend interface via HTTPS protocol, return to your server’s terminal and create a .htaccess file based on the supplied htacess.txt file in your website path.

cd /var/www/html/
cp htaccess.txt .htaccess

Open .htaccess file and add the following lines at the bottom of the file, after this line:

## End - Joomla! core SEF Section

The first block of the file helps you tamper the native PHP settings offered by the server.

nano /var/www/html/.htaccess

.htaccess file excerpt:

# Modify PHP settings
php_flag register_globals off
php_flag magic_quotes_gpc Off
php_value max_execution_time 200
php_value max_input_time 200
php_value upload_max_filesize 999M
php_value post_max_size 999M
# Redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

That’s all! You have successfully installed and configured Joomla! CMS on Debian 9. However, because your Apache HTTP server uses Self-Signed certificates to encrypt the traffic between the server and visitor’s browsers, a warning message will always be displayed to visitors. To get rid of that warning, replace the self-signed SSL certificate with a free SSL cert from Let’s Encrypt.

For other custom configurations regarding Joomla! CMS, visit the documentation page at the following address:

How to Install Joomla! CMS on Debian 9