Let’s install Drupal on Debian 10, Buster.
Be sure to have the following as you get started out.
- An instance of Debian 10 with SSH access
- A configured sudo user to perform privileged tasks
Step 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 Debian 10. Once you have the LAMP server installed, proceed to the next step.
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.
To log in to the MariaDB shell, run the command:
$ sudo mysql -u root -p
Begin by creating a database called mydrupaldb as shown. Of course, you are liberty to provide your preferred database name.
> CREATE DATABASE mydrupaldb;
Next, create a database user for the Drupal database.
> CREATE USER ‘mydrupal_user’@’localhost’ IDENTIFIED BY ‘user_password’;
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’;
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.
Step 3: Download Drupal
Next, access the official download page for Drupal and download the tarball file as shown.
$ wget https://www.drupal.org/download-latest/tar.gz
Next, extract the compressed file to the webroot directory as provided.
$ sudo tar -xvf drupal.tar.gz -C /var/www/html
This takes a few seconds and extracts hundreds of files into a folder labeled drupal-9.1.6. 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
Next, set the directory ownership of the drupal directory to www-data user.
$ sudo chown -R www-data:www-data /var/www/html/drupal
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.
Step 4: Create Drupal’s configuration file
The last part is to create a configuration file or virtual host file for Drupal. So, using your favorite text editor, create the file below.
$ sudo vim /etc/apache2/sites-available/drupal.conf
Add the lines shown below. 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.
Once done, save and exit the Drupal config file. Next, enable the Drupal virtual host as follows:
$ sudo a2ensite drupal.conf
Then invoke the a2enmod script file to enable the Apache module rewrite as shown:
$ sudo a2enmod rewrite
To effect the changes, reload or restart Apache.
$ sudo systemctl restart apache2
We are almost there. The last bit will involve completing the setup from a browser.
Step 5: Setup Drupal from the browser
From your web browser, follow the URL shown:
http://server-IP or domain-name
Select your language as provided by the welcome page.
Next, three installation profiles will be provided as shown. To keep it simple, select the ‘Standard’ profile as shown.
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 as shown. From here, you can proceed and create your website or blog using various templates that Drupal provides.
Drupal is a powerful CMS that allows you to design stunning websites and blogs with simple tools and drag and drop features in a matter of a few hours. It offers flexibility in terms of customization of your site to meet your desired results. You can easily get started with free templates before advancing to premium templates that have more features. This concludes our guide. We appreciate your time.