How to Install Drupal 9 CMS on Debian 11

Install Drupal 9 CMS on Debian 11 and start flexibly addressing your online content. Quick access to Drupal 9 will let you create blogs and websites that feature not only vivid customization ability but also bags super-efficient management credentials.

With Drupal 9, you’re looking at an open-source content management utility. Designed and written in PHP, Drupal 9 is meant to help users irrespective of how strong their web programming background is. Loaded with more than 17000 plugins, you can seamlessly create and manage an online home for your content.

How to Install Drupal 9 CMS on Debian 11

Here, I’ll help you install Drupal 9 CMS on Debian 11 followed by uncovering the entire process involved in getting the setup configured.

System Requirements

  • To install Drupal 9 CMS on Debian 11 with no issues whatsoever, check if you’ve access to the following;
  • PHP (Recommended Version: 7.3+)
  • A fully operational Debian system with Sudo privileges
  • Database servers (like MySQL, MariaDB, etc.)
  • Web Server (Apache, Nginx, etc.)

Step 1: Update System Repositories

Start by making sure your system repositories are updated. For this, all you need to do is launch the Terminal by hitting the “Ctrl+Alt+K” key combination followed by invoking the command as:

$ sudo apt update && sudo apt upgrade
Update System Repositories

Step 2: Get Vim

Run the following command: 

$ sudo apt install wget vim
getting VIM editor

Step 3: Install LAMP Stack on Debian 11

Now that we’ve updated the system and also installed the required packages, you’re ready to begin and install Drupal 9 CMS on Debian 11. To do that, we’ll employ the Apache webserver alongside PHP and the MariaDB database.

Launch the Terminal

Run the following command:

$ sudo apt install apache2 mariadb-server mariadb-client php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc 
install LAMP on debian 11 and install drupal 9 cms on debian 11

Step 4: Verify the PHP Version

Next, you’ll need to verify the installed PHP version using the -v flag.

$ php -v
verifying the php version

It will probably display an output like:

PHP (version number) (cli) (built: Date_Time) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v(version number), Copyright (c), by Zend Technologies

Step 5: Enable Mod Rewrite for Apache

As soon as you’re done verifying the PHP version, run the following commands and enable the mod-rewrite module for Apache:

$ sudo a2enmod rewrite
install drupal 9 cms on debian 11
$ sudo systemctl restart apache2

Before moving any further, make sure to verify if the module has been enabled by invoking the following command:

$ sudo apache2ctl -M | grep rewrite
verifying mode rewrite module and install drupal 9 cms on debian 11

When it says rewrite_module (shared), it signifies that the process has been successfully concluded.

And this pretty much wraps up the resources installation part.

Step 6: Configure MariaDB

The first step of configuring the installed database should always be securing it by setting the root password. You can do that proceeding as follows:

Launch the “Terminal”.

Start and enable MariaDB by running the following command:

$ sudo systemctl enable --now mariadb
enable mariadb and install drupal 9 cms on debian 11

Use the following command to start securing the database:

$ sudo mysql_secure_installation
msql secure installation

Your system will then come up with several options. You can proceed in the following pattern and finalize the secure process.

Enter current password for root (enter for none): Hit the Enter button
Switch to unix_socket authentication [Y/n] Input Y and hit Enter
Change the root password? [Y/n] Input Y and hit Enter
New password: [Input the desired password]
Re-enter new password: [Input the same password]
Remove anonymous users? [Y/n] Input Y and hit Enter
Disallow root login remotely? [Y/n] Input Y and hit Enter
Remove test database and access to it? [Y/n] Input Y and hit Enter
Reload privilege tables now? [Y/n] Input Y and hit Enter

Finally, you’ll see a message saying,Thanks for using MariaDB!

Creating a Database for Drupal 9 CMS on Debian 11

After you’ve secured the downloaded database, the next step is to create one. Doing this is pretty simple. Launch the Terminal and run the following command:

$ sudo mysql -u root -p
Creating a Database and install Drupal 9 CMS on Debian 11

When asked for the password, input the one set above. It will take you to the MariaDB shell. From there, invoke the below command and seamlessly create a database for the Drupal 9 CMS.

MariaDB [(none)]> CREATE DATABASE [desired name] CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Creating a Database User and Granting Access

Created a database isn’t enough as it is crucial to have a specific database user with full access to the database. Here is how you can do it:

Use the “Ctrl+Alt+T” key combination to launch the Terminal

Run the command in the following format:

install drupal 9 cms on debian 11 and granting access

Step 7: Download the Drupal 9 CMS on Debian 11

To download and Install Drupal 9 CMS on Debian 11, pass the wget command as:

$ wget [Link]

Extract the Downloaded Archive

After downloading the archive, you’ll need to extract it by running the following command:

$ tar xvf drupal-$[DRUPAL_VERSION].tar.gz

This will install Drupal 9 CMS on Debian 11.

Preparing Drupal 9 for Apache

If you’re done extracting the tar file, the next thing to do is move the folder to the Apache directory (/var/www/html)

Run the following command:

$ sudo mv drupal-$[DRUPAL_VERSION] /var/www/html/[name of the created database]

Setting Permissions of the Directory

To set permissions of the directory, use the chown command alongside the -R flag as follows:

$ sudo chown -R www-data:www-data /var/www/html/[name of the created database]

Step 8: Create the Apache Virtual Host for Drupal 9

For making the Drupal 9 site fully operational, creating a virtual host file for Apache is crucial. Doing this is no big deal. Launch the Terminal and run the following command:

$ sudo vim /etc/apache2/sites-available/[name of the created database].conf

Add the following lines in the configuration file using vim editor.

install drupal 9 cms on debian 11 and granting access

Remember to replace the “exampleurl.com” with your desired domain name.

Now your system is ready to enable the server. Run the ln command with the -s flag to do that.

$ sudo ln -s /etc/apache2/sites-available/[name of the created database]conf /etc/apache2/sites-enabled/[name of the created database].conf
install drupal 9 cms on debian 11

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

$ sudo systemctl restart apache2
restart apache

Check the Status of the Service

Run the following command to check the status of the service

$ systemctl status apache2
Check the Status of the Service

Probable Output:

status output

If it returns nothing, and you’re unable to access the page, you’ll need to move the default apache.conf file to a specific backup file.

Run the following command:

$ sudo mv /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf.bak
move the default apache.conf file to a specific backup file

Restart Apache.

sudo systemctl restart apache2
restart apache

Step 9: Using the Web UI to Configure Drupal 9 CMS

We’re down to the final few steps, and here you’ll install Drupal 9 CMS on Debian 11 browser. Launch any of the desired browsers and visit either http://server-ip/ or http//hostname

While you’re on the home page, set your preferred language and proceed. The next page is where you’ll pick a profile from the 3 available Drupal installation profiles. I’d recommend you opt for the standard option.

Up next input the database credentials we’ve created earlier, save the progress and continue. Finally, configure, and Voilà, you can now see the Drupal 9 welcome page. The setup is complete, and you can choose templates from the provided list, create blog websites, add content to them and do a lot more.

That’s basically how you install Drupal 9 CMS on Debian 11. In this article, I’ve walked you through the most detailed guide on Drupal 9 CMS installation in the most user-friendly manner. Reading through will ensure you learn everything that revolves around getting started with Drupal 9 on Debian 11.

If this guide helped you, please share it.

Leave a Reply
Related Posts