Installation and configuration of Drupal on CentOS 7

Version 1.0
Author: Srijan Kishore
Last edited: 13/Nov/2014

This document describes how to install and configure Drupal on CentOS 7. Drupal is an open source content management platform powering millions of websites and applications. It’s built, used, and supported by an active and diverse community of people around the world.

1 Preliminary Note

This tutorial is based on CentOS 7 server, so you should set up a basic CentOS 7 server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname.  You must have a LAMP server installed in CentOS 7.0 as mentioned in the tutorial to continue further.

2 Database initialization

I will create  the database for the Drupal as follows:

mysql -u root -p

Here we are adding database=drupaldb user=drupaluser and password=drupalpassword:

CREATE DATABASE drupaldb;

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

Further moving ahead:

FLUSH PRIVILEGES;
exit

Restart services

systemctl restart httpd.service
systemctl restart mariadb.service

 

CentOS 7.0 uses Firewall-cmd, so I will customize it to allow external access to port 80 (http) and 443 (https).

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

3 Installation of Drupal

We will first make a directory temp in which I will the download the latest version of the Drupal as follows:

mkdir temp
cd temp
yum install wget unzip
wget http://ftp.drupal.org/files/projects/drupal-7.33.zip

Though the LAMP stack offered a great foundation for a server, Drupal would still require a couple of additional packages for running seamlessly. You must download these packages using the following command:

yum install php-mbstring php-gd php-xml

unzip the Drupal zip file in the following created folder:

unzip -q drupal-7.33.zip -d /var/www/html/

It will create a folder as /var/www/html/drupal-7.30, I will rename the folder as /var/www/html/drupal. Here I am removing the version name only:

mv /var/www/html/drupal-7.33/ /var/www/html/drupal

Now give appropriate permissions in the directory

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

We need to create settings file from the default.settings.php file to settings.php in sites/default folder:

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

Drupal wants to have /var/www/html/drupal/sites/ and /var/www/htmldrupal/sites/default/settings.php writable. When dealing with SELinux we need to update context of the /var/www/htmldrupal/sites/ to read and write:

chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/

Now proceed to the web installation of Drupal. Go to the URL http://192.168.0.100/drupal:
Proceed with Standard and hit Save and continue.

 

Now by default English is selected, continue with Save and Continue:



  

Now we will proceed towards the login page by giving the  database information as selected at the time of the Drupal database creation:

In my case it was

Select MySQL, MariaDB, or equivalent
Database name = drupaldb
Database username = drupaluser
Database password = howtoforge
Datbase host = localhost


 

Give the information as per your choice, here I am using like:

Site name = Drupal site
Site e-mail address = [email protected]
Username = admin
Email-address = [email protected]
Password = howtoforge
Country = India
Default time-zone = Asia/kolkata +0530

The above values are user's specific, you can customize it according to your choice. Further press Save and Continue:

 



This will be your install Drupal.



Now proceed towards the Visit your new site.



Congratulations! You now have a fully functional Drupal instance on your CentOS 7.0 :)

Share this page:

2 Comment(s)