Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Drupal on Debian 10 - DesignLinux

Oct 13 2020
designlinux 0 Comments

Written PHP, Drupal is a free and opensource content management system (CMS) that enables you to create powerful and elegant blogs or websites. It ships with preinstalled themes, widgets, and other out-of-the-box features that help you get started with little knowledge in web programming languages. It’s ideal for users who want to publish their content with but have little background in web development.

In this article, you will learn how to install Drupal on Debian 10/9.

Drupal Prerequisites

Like any other CMS, Drupal runs on the front end and is powered by a database server on the backend. Therefore, you need to have a LAMP stack installed before anything else. LAMP comprises of the Apache web server, MariaDB / MySQL database, and PHP which is a server-side scripting language.

In this guide, we have used the following versions:

  • Apache webserver.
  • MariaDB database server.
  • PHP (For Drupal 9, PHP 7.3 and later versions is recommended).

With the requirements met, let’s get started!

Step 1: Install LAMP Stack on Debian 10

1. To install Drupal, you must have a running web-server and a database server, in this article we will work with Apache, PHP, and MariaDB, you can install them using apt command as shown.

$ 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 

2. Next, you need to apply some basic security measures on the database installation by running the following security script which ships with the MariaDB package.

$ sudo mysql_secure_installation

After executing the script, it will prompt you a series of questions where you can answer yes(y) to enable some basic security options as shown.

  • Enter current password for root (enter for none): Enter
  • Set a root password? [Y/n] y
  • Remove anonymous users? [Y/n] y
  • Disallow root login remotely? [Y/n] y
  • Remove test database and access to it? [Y/n] y
  • Reload privilege tables now? [Y/n] y
Secure MariaDB in Debian 10
Secure MariaDB in Debian 10

Step 2: Create a Drupal Database

3. Next, we will start by creating a database that will be used by Drupal for storing data during and after the installation. First, log into the MariaDB database server.

$ sudo mysql -u root -p

You will get the following welcome message.

Login into MariaDB Database
Login into MariaDB Database

4. Once you login to the MariaDB shell, we are going to create a database called drupal_db.

MariaDB [(none)]> create DATABASE drupal_db;

5. Next, we will create a database user with a strong password and grant the user full access to the Drupal database as shown.

MariaDB [(none)]> create USER ‘drupal_user’@’localhost’ IDENTIFIED BY “StrongPassword”;
MariaDB [(none)]> GRANT ALL ON drupal_db.* TO ‘drupal_user’@’localhost’ IDENTIFIED BY “password”;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Now that we have the Apache web server, Drupal database, and all the PHP extensions in place, we will move along and download the Drupal installation file.

Step 3: Download and Install Drupal in Debian

6. We are going to download Drupal’s compressed file from Drupal’s Official site as shown using the wget command.

$ sudo wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz

7. Once the download is complete, extract it in your current directory and move the uncompressed drupal folder to the /var/www/html path and list the directory’s contents as shown:

$ sudo tar -xvf drupal.tar.gz
$ sudo mv drupal-9.0.7 /var/www/html/drupal
$ ls -l /var/www/html/drupal
View Drupal Files
View Drupal Files

8. Next, modify the directory permissions to make Drupal accessible to the public.

$ sudo chown -R www-data:www-data /var/www/html/drupal/
$ sudo chmod -R 755 /var/www/html/drupal/

Step 4: Create an Apache Drupal Virtual Host

9. To serve Drupal on the front end, we need to create an Apache virtual host file to serve Drupal’s site. Using your favorite text editor, create the file as shown. Here, we are using the vim editor.

$ sudo vim /etc/apache2/sites-available/drupal.conf

Paste the content shown on the virtual host file.

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/drupal/
     ServerName  example.com  
     ServerAlias www.example.com

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

     <Directory /var/www/html/drupal/>;
            Options FollowSymlinks
            AllowOverride All
            Require all granted
     </Directory>

     <Directory /var/www/html/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>
</VirtualHost>

When you are done, save the changes and exit the file.

10. Up until this point, only the Apache Welcome page is accessible from a browser. We need to change this and have Apache serve the Drupal site. To achieve this, we need to enable Drupal’s virtual host. So, execute the following commands:

$ sudo a2ensite drupal.conf
$ sudo a2enmod rewrite

Finally, to effect the changes, restart the Apache webserver.

$ sudo systemctl restart apache2

11. If you have a UFW firewall running, open the HTTP port as shown.

$ sudo ufw allow 80/tcp
$ sudo ufw reload

Step 6: Setup Drupal from a Browser

12. This is the final step in the installation of Drupal and it requires setting it up on a browser. So, fire up your favorite browser and browse your server’s IP address as shown:

http://www.server-ip/

The installer will take you through the steps before completing the setup. On the first page, you will be required to choose your preferred language as shown. Select your desired language and click ‘Save and Continue’.

Choose Drupal Language
Choose Drupal Language

13. There are 3 installation profiles that you can use to install Drupal, But for simplicity’s sake, we will go with the ‘Standard’ profile.

Choose Drupal Installation Profile
Choose Drupal Installation Profile

14. In the next step, fill out the database details for Drupal as specified above and click ‘Save and Continue’.

Set Drupal Database Settings
Set Drupal Database Settings

15. Drupal’s installer will begin to install all the files and database modules.

Drupal Installation Progress
Drupal Installation Progress

16. Once the installation is complete, you will be required to provide your site’s details such as Site name, site address, timezone, and location to mention a few. Be sure to fill in all the details.

Set Drupal Site Settings
Set Drupal Site Settings

17. Finally, you will get the default dashboard for Drupal as shown:

Drupal Dashboard
Drupal Dashboard

From here, you can go on and create your blog or website using various templates and customize the look and feel to your preference. That’s it for today. We hope that you can comfortably install Drupal on your Debian instance.

Related

Tags: Debian Tips, drupal

Bash if..else Statement

Prev Post

How to Create and Select MySQL Database

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 259
  • 614,631

DesignLinux.com © All rights reserved

Go to mobile version