How to Install Drupal on a Virtual Server Running CentOS 6

Introduction

 

Drupal is a free and open-source content management system written in PHP. It uses the object oriented programming techniques for enabling powerful online applications and stores data in a database like MySQL or MS SQL.

In this tutorial, you will learn how to install Drupal on a virtual server running CentOS 6.
 

Prerequisites

 

  • This tutorial assumes that you already have LAMP stack installed in your server. If you don’t have LAMP stack on your sever, you can find the steps for doing the set up here.
  • The user should have root privileges so as to have administrative capabilities and permissions. You can check out how to grant root privileges for user here.

Now that you have the user with root privileges and mandatory software, let’s get down to installing Drupal.
 

Download Drupal

 

You can download the latest version of Drupal from their website. Here, I have used the version 7.15. Run the following command to download:

wget  http://ftp.drupal.org/files/projects/drupal-7.15.tar.gz

You will have the Drupal package in zipped format inside user’s home directory in your virtual server. Untar it using the command given below:

tar zxvf drupal-7.15.tar.gz

Now, move it to the default web directory, apache /var/www/html directory in this case.

sudo mv drupal-7.15 /var/www/html

 

Download of Additional Packages

 

Drupal would require a few other packages too in order to work fine.

Let’s go ahead and download the packages using the command below:

sudo yum install php-mbstring php-gd php-xml

 

Configuring the Settings

 

Once the required packages are installed, let’s configure the settings.

Move the Drupal files into the web directory and switch to the drupal directory:

cd /var/www/html/drupal-7.15

Copy the default settings file and rename it. Let the default file remain like that as you will need both the files later for Drupal installation.

cp sites/default/default.settings.php sites/default/settings.php

Give write permissions to the installer to write the configuration file:

chmod a+w sites/default/settings.php
chmod a+w sites/default

 

Creation of Drupal Database and User

 

For creating a database and a user for Drupal, we will be logging into the MySQL shell.

Log in with mysql root credentials:

mysql -u root -p

Let’s go ahead and create a database for Drupal. Here, I have named it drupaldb. You may wish to change it with your values.

For Creating a Database:

CREATE DATABASE drupaldb;
Query OK, 1 row affected (0.00 sec)

For Creating a User:

CREATE USER [email protected];
Query OK, 0 rows affected (0.00 sec)

For User Password Setup:

SET PASSWORD FOR [email protected]= PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Now, you can grant all the privileges for the new user. Without proper privileges, you may end up with installation and database permission issues.

GRANT ALL PRIVILEGES ON drupaldb.* TO [email protected] IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Finish up this step by refreshing and exit out of the shell.

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

 

Exit

Now, restart apache:

sudo service httpd restart

 

 Accessing the Drupal Installer

 

This is the last stage of your Drupal installation. Open your browser and access the Drupal installer by tailoring your site’s IP address or domain name. Go through its steps and you will be done with the installation.

support2 has written 111 articles

Leave a Reply