Atlantic.Net Blog

How to Install Drupal 9 on Rocky Linux 8

Hitesh Jethva
by Atlantic.Net (429 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Drupal is a free, flexible, open-source CMS software solution that allows you to build and deploy a website without any coding knowledge. It is written in PHP and uses MySQL/MariaDB as a database backend. Drupal provides a simple and powerful admin interface to manage your content, media, and other assets easier than ever before. It is very similar to other CMS platforms, such as WordPress and Joomla, and helps your organization connect with users, customers, and visitors wherever they are.

In this tutorial, we will show you how to install Drupal 9 CMS with Apache on Rocky Linux 8.

Prerequisites

  • A fresh Rocky Linux 8 server on the Atlantic.Net Cloud Platform
  • A valid domain name pointed to your server IP
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Rocky Linux 8 server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Apache and MariaDB Server

First, install the Apache web server and MariaDB database server using the following command:

dnf install httpd mariadb-server curl unzip git -y

Once both packages are installed, start the Apache and MariaDB services and enable them to start at system reboot:

systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb

Step 3 – Install PHP and Other Extensions

Next, it is recommended to install the latest version of PHP and other extensions to your server. By default, the latest version of PHP is not included in the Rocky Linux default repository, so you will need to install it from the Remi repository.

You can install the Remi repository with the following command:

dnf install epel-release -y
dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Once installed, reset the default PHP repository and enable the PHP 8.0 repository with the following command:

dnf module reset php
dnf module enable php:remi-8.0

Output:

Last metadata expiration check: 0:00:12 ago on Sunday 08 August 2021 04:13:36 AM UTC.
Dependencies resolved.
===============================================================================================================================================
 Package                           Architecture                     Version                            Repository                         Size
===============================================================================================================================================
Enabling module streams:
 php                                                                remi-8.0                                                                  

Transaction Summary
===============================================================================================================================================

Is this ok [y/N]: y

Next, install the PHP 8 and other extensions using the following command:

dnf install php php-curl php-mbstring php-gd php-xml php-pear php-fpm php-mysql php-pdo php-opcache php-json php-zip php-soap php-xmlrpc -y

Once all the packages are installed, verify the PHP version with the following command:

php -v

Output:

PHP 8.0.9 (cli) (built: Jul 29 2021 12:53:58) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.9, Copyright (c), by Zend Technologies

Next, edit the php.ini file and tweak some settings:

nano /etc/php.ini

Change the following lines:

memory_limit = 256M
date.timezone = Asia/Kolkata

Save and close the file when you are finished.

Step 4 – Create a Drupal Database

Next, you will need to create a database and user for Drupal. First, connect to the MariaDB with the following command:

mysql

Once you are connected, create a database and user using the following command:

CREATE DATABASE drupaldb;
GRANT ALL ON drupaldb.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'securepassword';

Next, flush the privileges and exit from the MariaDB shell:

FLUSH PRIVILEGES;
EXIT;

Step 5 – Download Drupal

First, download the latest version of Drupal from its official website using the following command:

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

Once the download is completed, extract the downloaded file with the following command:

tar xvf drupal.tar.gz

Next, move the extracted directory to the Apache root directory:

mv drupal-*/  /var/www/html/drupal

Next, create a file directory required for Drupal and copy a sample settings.php file:

mkdir /var/www/html/drupal/sites/default/files
cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php

Next, set proper ownership and permissions on the drupal directory:

chown -R apache:apache /var/www/html/drupal
chmod -R 755 /var/www/html/drupal

Step 6 – Configure Apache for Drupal

Next, create an Apache virtual host configuration file for Drupal with the following command:

nano /etc/httpd/conf.d/drupal.conf

Add the following lines:

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

     CustomLog /var/log/httpd/access_log combined
     ErrorLog /var/log/httpd/error_log

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

Save and close the file, then restart the Apache service to apply the changes:

systemctl restart httpd

Step 7 – Access Drupal Website

Now Drupal is installed and configured. You can now access it using the URL http://drupal.example.com. You should see the following screen:
Drupal select language
Select your Language and click on Save and continue button. You should see the following screen:
Drupal select installation type
Select an installation type and click on the Save and continue button. You should see the following screen:
Drupal Database Configuration Page
Provide your database information and click on the Save and continue button. You should see the Drupal site information on the following screen:
Drupal Site Configuration Page
Drupal Site Configuration Page
Provide your site information and click on the Save and continue button. Once the installation has been completed, you should see the Drupal dashboard on the following screen:
Drupal Dashboard Page

Conclusion

In the above guide, you learned how to install Drupal with Apache on Rocky Linux 8. You should now have enough knowledge to install Drupal on a live server easily – get started with Drupal on your Atlantic.Net dedicated server.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Sails.js Framework with Nginx on Oracle Linux 8
How to Install OTRS on Oracle Linux 8
How to Install and Configure Caddy Web Server with PHP on Oracle Linux 8
How to Install and Use PIP Python Package Manager on Oracle Linux 8
How to Install FTP Server with ProFTPD on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources