At the mention of popular content management systems, Drupal usually ranks among the top and most widely used systems.
Written in PHP, Drupal is an open-source and free CMS that is used for creating stunning blogs and websites.
It provides a wide variety of tools, templates, and plugins to create powerful and elegant websites with excellent security and reliability.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to resolve related Drupal errors.
In this context, we shall look into how to install Drupal on Debian 10, Buster.
Steps to install Drupal on Debian ?
Before proceeding with this installation procedure, ensure that you are using a configured sudo user to perform privileged tasks on an instance of Debian 10 with SSH access.
Then, follow the steps given below.
1. Install LAMP on Debian Buster
Drupal is written in PHP, and just like any other CMS such as WordPress that stores data in a MySQL or MariaDB database and is accessed from a browser, it requires a LAMP stack to work.
LAMP comprises the popular Apache web server, MySQL (or MariaDB) database, and PHP scripting engine.
We already have an elaborate guide on how to install LAMP on Linux Mint.
Once you have the LAMP server installed, proceed to the next step.
2. Create a database for Drupal
A database for Drupal is mandatory because it will store the installation files as well as other data after installation.
Our database engine of choice is MariaDB which is a fork of MySQL and provides the latest clustering technology and high-performance storage engines.
i. To log in to the MariaDB shell, run the command:
$ sudo mysql -u root -p
ii. Begin by creating a database called mydrupaldb.
Of course, you are liberty to provide your preferred database name:
> CREATE DATABASE mydrupaldb;
iii. Next, create a database user for the Drupal database:
> CREATE USER 'mydrupal_user'@'localhost' IDENTIFIED BY 'user_password';
iv. Be sure to grant all the privileges to the database user on the Drupal database.
> GRANT ALL ON mydrupaldb.* TO 'mydrupal_user'@'localhost' IDENTIFIED BY 'user_password';
v. Then, save the changes and exit.
> FLUSH PRIVILEGES
The database for our Drupal installation is in place. Let's plod along and now grab a copy of the Drupal installation file.
3. Download Drupal
i. Next, access the official download page for Drupal https://www.drupal.org/download and download the tarball file as shown:
$ wget https://www.drupal.org/download-latest/tar.gz
ii. Next, extract the compressed file to the webroot directory as provided:
$ sudo tar -xvf drupal.tar.gz -C /var/www/html
iii. This takes a few seconds and extracts hundreds of files into a folder labeled drupal-9.1.6.
iv. Let's rename the directory to drupal to make our configuration easier:
$ sudo mv /var/www/html/drupal-9.1.6 /var/www/html/drupal
v. Next, set the directory ownership of the drupal directory to www-data user:
$ sudo chown -R www-data:www-data /var/www/html/drupal
vi. Thereafter, configure the directory permissions as follows to allows read and execute permissions to all users:
$ sudo chmod -R 775 /var/www/html/drupal
With the right set of permissions in place, let's proceed and create a virtual host file for our Drupal instance.
4. Create Drupal's configuration file
The last part is to create a configuration file or virtual host file for Drupal.
i. So, using your favorite text editor, create the file below.
$ sudo vim /etc/apache2/sites-available/drupal.conf
The ServerName attribute can take either your IP address or domain name if you have an FQDN pointed to the IP of your Debian 10 instance.
ii. Add the lines shown below:
Options Indexes FollowSymLinks
Require all granted
CustomLog /var/log/apache2/drupal_access.log combined
i. example.com is your site domain
ii. /var/www/html/drupal is the location of Drupal files
iii. /var/log/apache2/ is the location of Apache log files
For https access, check Drupal SSL Configuration guide.
iii. Once done, save and exit the Drupal config file. Next, enable the Drupal virtual host as follows:
$ sudo a2ensite drupal.conf
iv. Then invoke the a2enmod script file to enable the Apache module rewrite as shown:
$ sudo a2enmod rewrite
v. To effect the changes, reload or restart Apache.
$ sudo systemctl restart apache2
Next, we will complete setup from a web browser.
5. Setup Drupal from the browser
From your web browser, follow the URL shown:
http://server-IP or domain-name
From here, Select your language as provided by the welcome page.
Next, three installation profiles will be provided.
To keep it simple, select the 'Standard' profile.
Next, provide the database details that you provided in Step 2.
Next, provide your site's details with information such as the site name, email address, username, and password to the Drupal account.
Scroll and click on 'Save and continue' at the very bottom.
The installation will begin as the installer installs all of Drupal's packages and modules.
Once done, you will be ushered to Drupal's dashboard.
From here, you can proceed and create your website or blog using various templates that Drupal provides.
[Need urgent assistance in fixing Drupal Configuration errors ? We can help you. ]