How To Install Drupal CMS 8.8 Version on Linux

How to install and configure Drupal 8 with database connection on Linux. Drupal is a web content management framework that is basically used for making websites and applications. It’s open-source and written in PHP language. It comes with great features like easy content authoring, reliable performance, and security, etc.

How To Install Drupal CMS 8.8 on CentOS 8:

You can download the latest version of drupal. Install the Apache webserver and start and enable Apache service at boot time.  

Check Out: How To Install NPM, NodeJS, and Angular On Linux

Install Apache, PHP, and Extract Drupal:

We will need to have a web server and PHP for the installation of the drupal because all the CMS works on the LAMP stack.

[root@drupal ~]# yum install httpd -y
[root@drupal ~]# yum install php-curl php-mbstring php-gd php-xml php-pear php-fpm php-mysql php-pdo php-opcache php-json php-zip
[root@drupal ~]# systemctl start httpd
[root@drupal ~]# systemctl enable httpd
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.

Once you downloaded the package, extract them.

[root@drupal ~]# tar -xvf drupal-8.8.5.tar.gz -C /var/www/html/
[root@drupal html]# mkdir drupal
[root@drupal html]# mv drupal-8.8.5/ drupal
[root@drupal html]# cd /drupal/

Create the virtualhost for drupal sites.

[root@drupal ~]# vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
DocumentRoot /var/www/html/drupal
<Directory /var/www/html/drupal/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
ErrorLog /var/log/httpd/drupal_error.log
CustomLog /var/log/httpd/drupal_access.log combined
[root@drupal ~]# httpd -t
[root@drupal ~]# systemctl reload httpd 

Check Out: Install and Configure S3CMD Tool For Data Sync On S3 Bucket

Install MySQL for Drupal:

We will install MySQL on CentOS 8 and it will install the MySQL 8. we need to start and Enable services. we have configured it but we won’t use it at the time of installation. you can use your own database credentials when you install it.

[root@drupal ~]# yum install mysql mysql-server -y
[root@drupal ~]# systemctl start mysqld
[root@drupal ~]# systemctl enable mysqld
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mysqld.service.

We’ll create a database and the user then assign the permission to the user on the database. 

[root@drupal ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database drupaldb;
Query OK, 1 row affected (0.01 sec)
mysql> use drupaldb;
Database changed

mysql> create user 'drupaluser'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on drupaldb.* to 'drupaluser'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Now Check, you’re able to login with the user or not on the MySQL server.

[root@drupal ~]# mysql -h localhost -u drupaluser -p
Enter password:

Check Out: Configure Redis Master and Slave Replication On Linux

Configuration part of Drupal:

We will start the configure drupal here but we need to perform few tasks before jumping on the configuration part. we have to change the owner and group of the drupal here with apache.  So, the apache will be running it. 

[root@drupal ~]# cd /var/www/html/
[root@drupal html]# chown -R apache:apache drupal/

We will create a setting.php file because default.settings.php already presents.

[root@drupal default]# cd /var/www/html/drupal/sites/default
[root@drupal default]# cp default.settings.php setting.php

You will have to open the ports in the firewall rules for Apache and MySQL.

[root@drupal ~]# firewall-cmd --permanent --add-port=80/tcp
[root@drupal ~]# firewall-cmd --permanent --add-port=3306/tcp
[root@drupal ~]# firewall-cmd --reload

If you face any issue in accessing the URL, it might be because of SELinux enabled on the server. you can either disable it or run the below command to change the context of it.

[root@webexam ~]# ls -lZa /var/www/html/drupal
[root@webexam ~]# chcon -R -t httpd_sys_content_t /var/www/html/drupal

Now access the Drupal with http://server_ip/drupal and select your language then click on save and continue.

Select an installation process to choose the standard.

drupal 8 database config file location

Check Out: How To Install WordPress 4.9.x On Redhat/CentOS 7

I’m choosing the default database SQLite. you can choose your database when you see the options here. we can also set the prefix for database tables.

how to install drupal

Once you're done with the above settings it will start the installation process.

install drupal

I’m going to configure our first site with the below details mentioned in the figure.

install drupal on linux

When everything goes write, you’re able to see the dashboard and login to your admin panel.

drupal install linux

You’re done install drupal on linux database connection  8 

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment