How To Install Drupal on Linux Mint 20
In this tutorial, we will show you how to install Drupal on Linux Mint 20. For those of you who didn’t know, Drupal is one of the most popular open-source CMS platforms worldwide. It is 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. It’s both a backend and front-end platform, with the backend riding on MySQL database and the front-end powered by PHP and Javascript.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Drupal content management systems on a Linux Mint 20 (Ulyana) server.
Prerequisites
- A server running one of the following operating systems: Linux Mint 20 (Ulyana).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Drupal on Linux Mint 20 Ulyana
Step 1. Before running the tutorial below, it’s important to make sure your system is up to date by running the following apt
commands in the terminal:
sudo apt update
Step 2. Installing LAMP (Linux, Apache, MariaDB, and PHP) server.
A Linux Mint LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Installing Drupal on Linux Mint 20.
Now we download the Drupal installation package using wget
the command:
wget https://ftp.drupal.org/files/projects/drupal-9.1.9.zip
Extract the compressed file to create the Drupal directory structure:
unzip drupal-9.1.9.zip mv drupal-9.1.4 /var/www/drupal
We will need to change some folders permissions:
chown -R www-data.www-data /var/www/drupal chmod -R 755 /var/www/drupal
Step 4. Configuring MariaDB for WordPress.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set 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
Next, we will need to log in to the MariaDB console and create a database for Drupal. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Drupal installation:
CREATE DATABASE mydrupaldb; CREATE USER ‘mydrupal_user’@’localhost’ IDENTIFIED BY ‘your-strong_password’; GRANT ALL ON mydrupaldb.* TO ‘mydrupal_user’@’localhost’ IDENTIFIED BY ‘your-strong_password’; FLUSH PRIVILEGES EXIT
Step 5. Configuring Apache for Drupal.
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘drupal.conf
’ on your virtual server:
touch /etc/apache2/sites-available/drupal.conf ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf nano /etc/apache2/sites-available/drupal.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin admin@yourdomain.com DocumentRoot /var/www/drupal ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/drupal/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Now, we can restart the Apache webserver so that the changes take place:
sudo a2ensite drupal.conf sudo a2enmod rewrite sudo systemctl restart apache2.service
Step 6. Configure Firewall
In case, you enabled UFW firewall and firewall block requests of the apache web server, open a port in the firewall:
sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reload
Step 7. Accessing a Drupal Web Interface.
Drupal will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com
and complete the required steps to finish the installation.
Congratulations! You have successfully installed Drupal. Thanks for using this tutorial for installing the latest version of Drupal CMS on the Linux Mint system. For additional help or useful information, we recommend you check the official Drupal website.