How to install Drupal on Debian 8 Jessie

In this tutorial, we will show you how to install Drupal on Debian 8 Jessie and configure the server. For those of you who didn’t know Drupal is one of the most popular open source content management systems (CMS) based on the PHP platform for creating personal blogs or large corporate websites. It has thousands of templates and plugins that are mostly free to download and install. Due to its resilient foundation, responsive platform, and its vibrant community, Drupal remains a popular choice after Wordpessas more than ten years on the stage.

This article assumes that you at least have basic Linux knowledge, know how to use the shell, and most importantly, you host the site on your VPS. The installation is very simple and assumes you are running under the root account, if you do not have root access you may need to add ‘sudo‘to commands to get superuser privileges. I will walk you through the installation of Drupal on a Debian 8 (Jessie) server step by step.

Installing Drupal on Debian 8 Jessie

Step 1. Software update

Before installing any software, it is very important to ensure that your system is up to date by running this following command in a terminal:

apt-get update
apt-get upgrade

Step 2. Install LAMP server (Linux, Apache, MariaDB, PHP).

LAMP server requires Debian 8. If you don’t have LAMP installed, you can follow our guide here.

Step 3. Installing Drupal on Debian 8.

The first thing to do is go to the Drupal download page and download the latest stable version of Drupal.At the time of this writing, this is version 8.2.6:


Unpack the Drupal archive to the document root on your server:

unzip drupal*.zip
cp -rf drupal*/* /var/www/html/

We will need to change some folder permissions:

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

Step 4. Configuring MariaDB for Drupal.

By default, MariaDB is not secure. You can provide MariaDB with a script mysql_secure_installation… You must read and go through each step, which will set the root password, remove anonymous users, disable remote administrator logins, and remove the test database and access to secure MariaDB:


Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log into the MariaDB console and create a database for Drupal. Run the following command:

mysql -u root -p

You will be prompted for a password, so enter your MariaDB administrator password and press Enter. Once you are logged in to the database server, you need to create a database to install Drupal:

create database drupal;
grant all privileges on drupal.* to [email protected] identified by 'ваш_пароль';
flush privileges;

Step 5. Configuring Apache web server for Drupal.

You need to create a new Apache virtual host directive for your domain. You can create the file using your favorite text editor. For example, we use nano:

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

Replace your_domain with your actual domain name and paste the following code into the file:

<VirtualHost *:80>
ServerAdmin [email protected]_domain
ServerName your_domain
DocumentRoot /var/www/html/
<Directory /var/www/html/>
RewriteEngine on
RewriteBase /mysite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Activate the rewrite module and include the new virtual host directive:

a2enmod rewrite
a2ensite your_domain.conf

We can now restart the Apache web server to apply the changes:

systemctl restart apache2.service

Step 6. Access to Drupal.

Drupal will be available on HTTP on port 80 by default. Open your favorite browser and go to or HTTP: // server-IP and follow the necessary steps to complete the installation. Remember that you need the database name, username and password created earlier to connect. If you are using a firewall, you will need to open port 80 to allow access to the control panel.

Congratulations! You have successfully installed Drupal. Thank you for using this tutorial to install the Drupal Content Management System (CMS) on a Debian 8 Jessie server. For more help or useful information, we recommend that you check the official Drupal website.