How to Install Drupal 9 on Fedora 34

Drupal is an open-source content management system (cms) that is very flexible for building websites and applications. About 2.5 percent of the websites in the world are using Drupal. It is in use by many industries like Retail, Ecommerce, Healthcare etc.

Drupal comes packed with many features that make it apart from others. We have listed some of them here:

  • With Drupal, websites can load very fast and can scale as per the need of increasing traffic load.
  • Drupal provides automatic language conversion based on the geographic location of an area. This helps in delivering content in the localized language.
  • Security features like access control, encryption, DoS mitigation etc., Drupal has proven to be a very secure and stable platform.
  • Many marketing tools are available to attract and track potential customers.

Let us now move to the procedure for installing Drupal 9 on Fedora 34 OS. The current version available at the time of writing this tutorial is Drupal 9.0.+

Before We Begin…

Ensure the following prerequisites before starting the installation process:

  • User account with super user privileges.
  • Access to the internet.

Installing Drupal 9 on Fedora 34 Workstation

In this guide, we will install Drupal with PHP, Apache (httpd) web server, and MariaDB database server. It can also be installed with database servers like SQLite, PostgresQL, MySQL etc., and web servers like Nginx, Microsoft IIS.

Step 1. Install all the required components and dependencies with the command:

sudo dnf install httpd php php-mysqlnd php-gd php-xml mariadb-server mariadb php-mbstring php-json

Install MariaDB Apache Php

Step 2. Start and enable the Apache and MariaDB services:

 sudo systemctl start httpd mariadb
 sudo systemctl enable httpd mariadb

Start enable mariadb apache

Setting Up MariaDB Server

Step 1. For the first time setup, run the ‘mysql_secure_installation ’ script to secure the database:

 sudo mysql_secure_installation 

A series of following questions will appear, choose the settings appropriate to you:

Enter current password for user root: [Enter here]
Switch to unix_socket: [Y/n] [Enter n]
Change the root password? [Y/n] [Enter n]
Remove anonymous users? [Y/n] [Enter y]
Disallow root login remotely? [Y/n] [Enter y]
Remove test database and access to it? [Y/n] [Enter y]
Reload privilege tables now? [Y/n] [Enter y]

Securing Mariadb

Step 2. After configuring MariaDB, we will create a database “test_db” and a user “test_user” with password “howtoforge”. First login to the MariaDB and run the subsequent commands to accomplish these tasks:

 sudo mysql -u root 

1. Create a database named as “test_db':

create database test_db;

2. Create a user named as “test_user”:

create user 'test_user'@'localhost' identified by 'howtoforge';

3. Provide the necessary permissions to the above user:

grant all privileges on test_db.* to 'test_user'@'localhost';

4. Reload the grant tables:

flush privileges;

5. Finally, exit the database using the command:


Setting up Database

Setting Up the Apache Web Server

Step 1. Open the configuration file for Apache with text editor of your choice:

sudo nano /etc/httpd/conf/httpd.conf

Step 2. Look for the “Document root ” entry and change it to appear like below:

DocumentRoot "/var/www"
<Directory "/var/www">  
DirectoryIndex index.html index.html.var index.php
Allowoverride All

Setting Up apache config file

Setting Up Drupal

Step 1. Now go to the Drupal website and download the latest version of Drupal (tar.gz) file. We will use the ‘wget’ command to download the file as drupal.tar.gz.

wget -O drupal.tar.gz

Step 2. Go to the folder ‘/var/www’ and extract the above file here:

 cd /var/www
 sudo tar -zxf /home/fedora34w/drupal.tar.gz

In our case ‘/home/fedora34w/’ is the download directory, change it to according to your download path.

Step 3. Make symbolic links for the extracted drupal directory:

 sudo ln -s drupal-9.1.7/ drupal

download and extract drupal

Step 4. Now go to the “drupal/sites/default” directory inside the ‘www’ directory and using the ‘cp’ command copy the default.settings.php file to settings.php:

 cd drupal/sites/default
 sudo cp -p default.settings.php settings.php

Step 5. Create a folder named as ‘files’ in the same directory (/var/www/drupal/sites/default) as settings.php:

sudo mkdir files

Step 6. To install Drupal, we need to set the permissions of ‘settings.php’ to 777. This will make this file to be world readable, writable and executable.

 sudo chmod 777 settings.php

After the installation is completed, we have to set back this permission to 644 for security reasons.

The permission for the ‘files’ folder needs to be set to 775:

 sudo chmod 775 files/

Step 7. Now make ‘apache’ as the owner of the drupal directory with command:

 sudo chown -R apache:apache /var/www/drupal-9.1.7

setting permissions for files and folders

Step 8. Restart Apache and configure the firewall to allow HTTP traffic:

 sudo systemctl restart httpd
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload

Step 9. We will temporarily disable the SElinux during the installation of Drupal and then re-enforce again it after installation:

sudo setenforce 0

restart apache, configure firewall, disable selinux

Setting up Drupal from Browser

1. Launch your web browser and navigate to your system IP followed by ‘/drupal’ tag or use the localhost instead of the IP address:

http://localhost/drupal or http://system_ip/drupal

2. The installation wizard will start up now. Select the language from the drop down list:

Select Installation language

3. On the next page, select the Standard profile option because it has many settings configured by default and various core modules are enabled. The minimal profile should be used if you want to customize the feature selection. The third option (Umami Food Magazine) is only for demo purposes.

Select installation profile

4. On the next page, you will see if any dependency or requirement is missing, otherwise, the setup will skip this page. If there is any missing component or any error, you can continue after fixing it. 

5. Next, select the database type using the radio button, in our case it is MariaDB. Put the details of the database (database name, database username, database password). Press “save and continue” to start the installation process:

insert database details

6. Drupal will start the installation of all of its components as shown in the picture below:

Start of drupal installation

7. To finish configuring Drupal, fill the following details on the next page:

Site Name, Site email address, Username, Password, User’s Email address, Default country, Default time zone 
Enter site details

After saving these details, the first page of your Drupal website will appear. Here you can add new pages and contents to your website:

Drupal welcome page

8. Once the above step is completed, revert back the permission of settings.php to 644 and enforce the SElinux policy again:

$ sudo chmod 644 settings.php
$ sudo setenforce 1

reverting file permission and selinux


Congratulations, this completes our guide about installing Drupal 9 on Fedora 34 workstations. Drupal is a popular CMS platform used by many famous businesses. Try building your personal website with Drupal’s extensive features set.

Share this page:

Suggested articles

0 Comment(s)

Add comment