Loading...

How to Install Drupal on CentOS 8

Simple.Predictable.Scalable

Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing Drupal on CentOS 8

Drupal is a free and open-source content management system (CMS) used for building websites and applications. It provides a flexible platform that allows users to easily manage and publish content, create customizable layouts, and add various functionalities through extensions and modules.

In this tutorial, we will guide you through the process of installing Drupal on CentOS 8.

Prerequisites

  • A CentOS 8 server with root access.
  • A LAMP (Linux, Apache, MySQL, PHP) stack already installed on your CentOS 8 server. If you have not set up LAMP, you can follow our tutorial on How to Install LAMP Stack on CentOS 8.
  • A domain name or IP address pointed to your server's public IP.

Step 1: Download Drupal

First, log in to your CentOS 8 server via SSH as the root user.

Change to the Apache document root directory:

cd /var/www/html

Download the latest stable version of Drupal using the following wget command:

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

Extract the downloaded file:

tar -xvzf tar.gz

Move the extracted Drupal directory to a more appropriate location:

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

Step 2: Configure Apache

Open the Apache default virtual host configuration file using a text editor:

vi /etc/httpd/conf.d/virtualhost.conf

Add the following configuration to the file:


    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html/drupal

    
        Options FollowSymLinks
        AllowOverride All
    

    ErrorLog /var/log/httpd/example.com_error.log
    CustomLog /var/log/httpd/example.com_access.log combined

Save and exit the file.

Step 3: Create the Drupal Database

Log in to the MySQL shell:

mysql -u root -p

Create a new database for Drupal:

CREATE DATABASE drupaldb;

Create a new database user and grant all privileges on the database:

CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;

Exit the MySQL shell:

EXIT;

Step 4: Install Drupal

Open your web browser and visit the following URL:

http://example.com/install.php

Replace "example.com" with your domain name or server IP.

Follow the on-screen instructions to complete the Drupal installation process. You will need to provide the database name, database user, and password that you created in Step 3.

After the installation is complete, remove the installation directory for security purposes:

rm -rf /var/www/html/drupal/install.php

Step 5: Secure Your Drupal Installation

Edit the Drupal configuration file:

vi /var/www/html/drupal/sites/default/settings.php

Locate the line that contains $settings['trusted_host_patterns'] and add your domain or IP address:

$settings['trusted_host_patterns'] = [
    '^www\.example\.com$',
];

Save and exit the file.

Disable the Apache directory listings:

vi /etc/httpd/conf.d/welcome.conf

Add a # in front of the following line to comment it out:

# Options -Indexes

Save and exit the file.

Restart the Apache service for the changes to take effect:

systemctl restart httpd

Congratulations! You have successfully installed Drupal on CentOS 8.

Now you can access your Drupal site by visiting your domain or server IP in your web browser.

Refer A Friend
Get $25

installing Drupal
CentOS 8
Drupal on CentOS
Drupal installation
CentOS 8 installation
setup Drupal on CentOS 8
installing Drupal on CentOS
Drupal setup on CentOS
CentOS 8 Drupal installation
how to install Drupal on CentOS 8.

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.