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

<img alt="Install MariaDB Apache Php" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/1.png609e9c804531e.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="451" loading="lazy" src="data:image/svg xml,” width=”750″>

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

 sudo systemctl start httpd mariadb
 sudo systemctl enable httpd mariadb

<img alt="Start enable mariadb apache" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/2.png609e9c8096cf1.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="372" loading="lazy" src="data:image/svg xml,” width=”750″>

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]

<img alt="Securing Mariadb" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/3.png609e9c8125084.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="750" loading="lazy" src="data:image/svg xml,” width=”451″>

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:

exit;

<img alt="Setting up Database" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/4.png609e9c81ba72a.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="513" loading="lazy" src="data:image/svg xml,” width=”750″>

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 "https://www.howtoforge.com/var/www"

  

DirectoryIndex index.html index.html.var index.php

Allowoverride All

<img alt="Setting Up apache config file" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/5.png609e9c823387c.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="504" loading="lazy" src="data:image/svg xml,” width=”675″>

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 https://www.drupal.org/download-latest/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

<img alt="download and extract drupal" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/6.png609e9c82b6341.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="530" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="setting permissions for files and folders" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/7.png609e9c8338c72.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="279" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="restart apache, configure firewall, disable selinux" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/8.png609e9c83aec7f.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="248" loading="lazy" src="data:image/svg xml,” width=”750″>

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:

<img alt="Select Installation language" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/9.png609e9c8446b77.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="396" loading="lazy" src="data:image/svg xml,” width=”750″>

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.

<img alt="Select installation profile" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/10.png609e9c84e8d60.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="431" loading="lazy" src="data:image/svg xml,” width=”750″>

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:

<img alt="insert database details" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/11.png609e9c85926e0.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="455" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="Start of drupal installation" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/12.png609e9c8631deb.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="425" loading="lazy" src="data:image/svg xml,” width=”750″>

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 
<img alt="Enter site details" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/13.png609e9c86c4778.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="750" loading="lazy" src="data:image/svg xml," width="653">

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

<img alt="Drupal welcome page" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/14.png609e9c874b571.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="507" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="reverting file permission and selinux" data-ezsrc="https://kirelos.com/wp-content/uploads/2021/05/echo/15.png609e9c87bd5f7.jpg" ezimgfmt="rs rscb3 src ng ngcb3" height="169" loading="lazy" src="data:image/svg xml,” width=”750″>

Conclusion

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.