How to Install Drupal on Debian 11

Install Drupal on Debian 11

In this article, we will have explained the necessary steps to install Drupal on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Drupal is a free and open-source content management system written in PHP. It is used to create and manage online content such as blogs, or websites. Drupal provides a wide variety of tools, templates, and plugins to create powerful and elegant websites with excellent security and reliability.

Install Drupal on Debian 11

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install LAMP Stack on Debian 11.

You’re going to need to set Debian up as either a LAMP server. If you haven’t done so already, use our traditional LEMP guide to set up Debian to serve before you continue.

Step 3. Install Drupal on the Debian system.

Installing Drupal on your Debian system is straightforward, All you need to do is open a terminal and run the following command to download the latest release version of Drupal from the Drupal release page:

sudo mv /var/www/html/drupal-9.2.4/ /var/www/html/drupal

Extract the tar.gz file into the webroot directory of your system:

sudo tar -xvf drupal.tar.gz -C /var/www/html

Then, set the appropriate permissions:

sudo chown -R www-data:www-data /var/www/html/drupal
sudo chmod -R 775 /var/www/html/Drupal

Step 4. Creating a Database for Drupal.

Drupal uses the MariaDB database to store all its data. Log in to your MariaDB server with the following command and enter your MariaDB root password:

mysql -u root -p

Once you’re in the MariaDB console, create a new database:

MariaDB [(none)]> CREATE DATABASE drupaldb;
MariaDB [(none)]> CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'your-password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
MariaDB [(none)]> EXIT;

Step 5. Create the Apache Virtual Host for Drupal.

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 nano /etc/apache2/sites-available/drupal.conf

Add the following lines in the configuration file using nano editor:

<VirtualHost *:80>
    ServerAdmin [email protected] ServerName DocumentRoot /var/www/html/drupal
    <Directory /var/www/html/drupal/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    ErrorLog /var/log/apache2/drupal_error.log
    CustomLog /var/log/apache2/drupal_access.log combined

Don’t forget to restart Apache and ensure all the alterations are successfully applied:

sudo a2ensite drupal.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 6. Accessing Drupal Web UI.

Final few steps, Launch any of the desired browsers and visit either http://server-ip-address/ or http//hostname.

That’s all you need to do to install Drupalon Debian (Bullseye). I hope you find this quick tip helpful. For further reading the Drupal open-source content management system on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.