How can I install Drupal on Debian 10 (Buster) Linux system?. Most new guys getting into blogging and website design always look for that perfect content management framework, that’s easy to use and with plenty of features. Drupal is an free and open source content management platform created to facilitate building of amazing digital content.
Our guide has been written to help you guys install Drupal on Debian 10 (Buster). As of this article writing, Drupal 8 is the most recent version of Drupal. If you’re following along when there is a newer version of Drupal, you may need to make few adjustments for the guide to fit.
Install Drupal on Debian 10 – System requirements
So before you start the installation, what are the minimal requirements for the setup?.
- Database server – MySQL, MariaDB, PostgreSQL, Percona, SQLite e.t.c.
- Web Server – Nginx, Apache, Caddy e.t.c
- PHP 7.x – >=7.2 recommended
- At least 1GB disk space – less should work just fine
Our installation of Drupal 8 on Debian 10 will cover setup of the required software packages and dependencies. So if you’re new to Linux and web hosting, there is no need to worry.
Step 1: Update System
Update you system packages and packages index.
sudo apt update
sudo apt -y upgrade
sudo reboot
Step 2: Install Database server
Choose a database server you want to use, this can be MySQL, MariaDB or PostgreSQL. One of the guides below should work for you.
Install PostgreSQL 11 / PostgreSQL 12 on Debian 10
In my Setup, I’ll use MariaDB database server. After database server installation, create database and user for Drupal 8 on Debian 10 (Buster) Linux.
$ mysql -u root -p
CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER drupal@localhost IDENTIFIED BY "StrongDBP@ss";
GRANT ALL ON drupal.* TO drupal@localhost IDENTIFIED BY "StrongDBP@ss";
FLUSH PRIVILEGES;
QUIT
Test database connection as drupal user.
$ mysql -u drupal -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.3.17-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| drupal |
| information_schema |
+--------------------+
2 rows in set (0.000 sec)
MariaDB [(none)]> QUIT
Bye
Step 3: Install PHP and required extensions
Our next installation is PHP and the extensions required to run Drupal on Debian 10. Install them by copying and running the following commands in your terminal.
sudo apt -y install php php-{cli,mysql,json,opcache,xml,mbstring,gd,curl}
Confirm your PHP version.
$ php -v
PHP 7.3.9-1~deb10u1 (cli) (built: Sep 18 2019 10:33:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.9-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies
Step 4: Install Web Server
Apache web server is the mostly used web server for hosting Drupal websites. Since it is the easiest to configure, we’ll install it.
sudo apt -y install apache2
Enable rewrite module.
sudo a2enmod rewrite
sudo systemctl restart apache2
Confirm that the module is loaded.
$ sudo apache2ctl -M | grep rewrite
rewrite_module (shared)
Step 5: Download Drupal 8 on Debian 10 (Buster)
Download the latest release of Drupal from the Drupal releases page.
sudo apt -y install wget
DRUPAL_VERSION="8.9.20"
wget https://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz
Extract downloaded archive file.
tar xvf drupal-${DRUPAL_VERSION}.tar.gz
Move folder created from extraction to /var/www/html directory.
sudo mv drupal-${DRUPAL_VERSION} /var/www/html/drupal
Set directory permissions.
sudo chown -R www-data:www-data /var/www/html/drupal
Step 6: Install Drupal 8 on Debian 10 (Buster)
Create Apache Configuration file for Drupal 8 on Debian 10.
sudo nano /etc/apache2/sites-available/drupal.conf
A basic configuration looks similar to below.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
DocumentRoot /var/www/html/drupal
<Directory /var/www/html/drupal/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/drupal_error.log
CustomLog /var/log/apache2/drupal_access.log combined
</VirtualHost>
Where:
- example.com is your site domain
- /var/www/html/drupal is the location of Drupal files
- /var/log/apache2/ is the location of Apache log files
For https access, check Drupal SSL Configuration guide.
Enable your website.
sudo ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf
Restart apache2 service after making the change.
sudo systemctl restart apache2
The service should be restarted without any errors.
$ systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-10-07 17:59:42 UTC; 8s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 13403 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 13407 (apache2)
Tasks: 6 (limit: 4719)
Memory: 14.0M
CGroup: /system.slice/apache2.service
├─13407 /usr/sbin/apache2 -k start
├─13408 /usr/sbin/apache2 -k start
├─13409 /usr/sbin/apache2 -k start
├─13410 /usr/sbin/apache2 -k start
├─13411 /usr/sbin/apache2 -k start
└─13412 /usr/sbin/apache2 -k start
Oct 07 17:59:42 deb10 systemd[1]: Starting The Apache HTTP Server...
Oct 07 17:59:42 deb10 systemd[1]: Started The Apache HTTP Server.
Open your browser and type the configured URL “http://example.com”, this is should be a record resolvable from DNS or in your /etc/hosts file.
Select your installation language and click “continue“.
On the next page, choose installation profile.
Provide database connection details. For remote database server, provide address under “ADVANCED OPTIONS”.
Installation should start.
Provide website domain, admin user,email and password.
This marks the end of installation of Drupal 8 on Debian 10. A success message is shown in the next page.
Thanks for using our guide to install drupal on Debian 10 (Buster). Visit Drupal Documentation page to learn more.
More on Debian 10
- Install PostgreSQL 12 on Debian
- How To Install PHP 7.4 on Debian 10
- How To Install and Configure GitLab CE on Debian 10 (Buster)
- How To Install and Configure HAProxy on Debian