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.
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:
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:
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 [email protected] 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.