How to Install Drupal on CentOS 8

Drupal is a free and open-source CMS written in PHP that ships with the GNU / GPL license. Just like popular CMS platforms such as WordPress and Joomla, with Drupal, you can get started with creating your own blog or website from the ground up with little or zero knowledge of web programming or markup languages.

In this tutorial, you will learn how to install Drupal on CentOS 8 Linux.

Prerequisites

Before we get started, ensure that you have installed the LAMP stack on your CentOS 8. LAMP is a popular stack used for hosting web hosting and consists of Apache web server, MariaDB / MySQL database and PHP.

Also, ensure that you have an SSH connection to your CentOS 8 server and a good and stable internet connection.

Step 1: Install Additional PHP Modules in CentOS 8

Drupal requires additional PHP modules to function without a hitch. So install them by executing the command below.

$ sudo dnf install php-curl php-mbstring php-gd php-xml php-pear php-fpm php-mysql php-pdo php-opcache php-json php-zip

Step 2: Create a Drupal Database

Having installed all the required PHP modules, you need to create a database to accommodate Drupal’s installation files. So log in to your MariaDB database as shown.

$ sudo mysql -u root -p

Once logged in, run the commands as shown to create a database for Drupal and grant all privileges on the Drupal user.

MariaDB [(none)]> CREATE DATABASE drupal_db;
MariaDB [(none)]> GRANT ALL ON drupal_db.* TO ‘drupal_user’@’localhost’ IDENTIFIED BY ‘[email protected]’;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Exit and restart the database server.

$ sudo systemctl restart mariadb

Step 3: Download Drupal in CentOS 8

With Drupal’s database in place, the next step will be downloading Drupal’s tarball file from Drupal’s official site. This contains all the necessary files required for Drupal to function as expected. At the time of writing this, the latest version is Drupal 8.8.4.

$ sudo wget https://ftp.drupal.org/files/projects/drupal-8.8.4.tar.gz

After the download complete, extract the tarball file as shown.

$ sudo tar -xvf drupal-8.8.4.tar.gz

Next, move the extracted folder to the Apache document root directory as shown.

$ sudo mv drupal-8.8.2 /var/www/html/drupal

With the drupal uncompressed file in the document root directory, modify the file permissions to allow apache to access the directory.

$ sudo chown -R apache:apache /var/www/html/drupal

Step 4: Configure Drupal Settings

Next, we are going to create a settings file from the default settings file (default.settings.php) which already exists in the following location.

$ cd /var/www/html/drupal/sites/default
$ sudo cp -p default.settings.php settings.php

In case SELinux is enabled on your system, run the command below to effect the SELinux rule on the /var/www/html/drupal/ directory.

Step 5: Finalizing Drupal Installation

We’re done with all the configurations. The only remaining bit is to set up Drupal on the browser. To do that, type the following address in your URL bar and hit ENTER.

http://server-IP/drupal

The ‘Welcome’ screen will be as shown. So first, select your preferred language and click the ‘Save and Continue’ button.

Choose Drupal Installation Language
Choose Drupal Installation Language

On the next screen, select the ‘Standard Profile’ as the profile to be used and click the ‘Save and Continue’ button to proceed to the next page.

Select Drupal Installation Profile
Select Drupal Installation Profile

Next, take a look at the overview of the requirements and enable clean URLs. To enable clean URLs, head out to the Apache configuration file located in the /etc/httpd/conf/httpd.conf file.

Set the AllowOverride attribute from None to All.

Drupal Requirements Review
Drupal Requirements Review

Next, refresh the page to continue to the ‘Database Configuration’ page as shown. Fill out the required fields such as the database type, database name, database password, and username.

Drupal Database Configuration
Drupal Database Configuration

Again, click on the ‘Save and Continue’ button to go to the next step. Drupal will commence installing all the features and will take about 5 minutes.

Drupal Installation on CentOS 8
Drupal Installation on CentOS 8

In the next section, Fill out the following details:

Drupal Site Configuration
Drupal Site Configuration

Finally, you will be presented with the home page as shown. You can now proceed to create your site and add content to it. You can use a vast array of Drupal themes and plugins to enhance your site’s appearance.

Drupal Homepage
Drupal Homepage

And this brings us to the end of this article. We have taken you through a step-by-step guide of how you can install Drupal on CentOS 8.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

2 thoughts on “How to Install Drupal on CentOS 8”

  1. Please don’t use steps 3 and 4 of this tutorial.

    Step 3: need to use a composer for drupal installation
    Step 4: This file will automatically create during drupal installation.

    Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.