• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Install and setup multisite drupal on CentOS 6.5

June 18, 2014 by Sharad Chhetri Leave a Comment

In this tutorial we will learn, how to install and setup multisite drupal on CentOS 6.5 . In multisite , we will do single drupal installation and create multiple website on it. It helps us to manage multiple website.

In multisite, each upgrade need to be done once. Whereas each site has its own database and configuration settings. Hence each sites have its own content,settings, enabled modules and themes.

Note:
* If the sites are similar in functionality (use same modules or use the same drupal distribution) do it.
* If the functionality is different don’t use multisite

Security Concerns

(Reference : https://drupal.org/documentation/install/multi-site#security )
You might want to reconsider using Drupal’s multi-site configuration, in situations where the administrators for all of the sites being run from the same code base are not either the same person or a small group with a high level of mutual trust. The reason is that anyone with full administrative privileges on a Drupal site can execute arbitrary PHP code on that site through various means (even without FTP access to the site), and that arbitrary PHP code could be used from one site to affect another site, if the two sites are in the same HTTP document root and sharing the same Drupal code.

So, unless you completely trust all of the administrators of the sites you are considering running from the same Drupal code base to be knowledgeable, careful, and not malicious, you might want to consider installing their Drupal sites in completely separate areas of the web server that are not able to affect each other via PHP scripting.

Summary:
We are creating 2 drupal sites.The domain names are given below
1. example.com
2. example2.com

Steps To Setup Multisite Drupal

Follow the given below steps to install drupal and making it as multisite.

Step 1 : Install Apache HTTP Server, MySQL Server and wget command

Web Server = Apache HTTP Server
Database Server = MySQL
wget(command) is for downloading the package(drupal).

yum install httpd mysql-server wget

Step 2 : Install PHP and required php modules

yum install php php-mysql php-pdo php-common php-cli php-gd php-mbstring php-dom

Step 3 : Download drupal package

Download latest drupal package from Drupal site .
By using wget command, we are downloading the drupal package

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

Note: Druapl version 7.28 is latest stable version. Recommend to download and use always latest stable version.

Step 4 : Untar the Drupal tarball and extract to /var/www/html/directory

Use tar command to extract the package.

tar -xvzf drupal-7.28.tar.gz -C /var/www/html/

Step 5 : Rename the extracted out drupal directory

Rename the directory which is extracted out from untar command.

mv /var/www/html/drupal-7.28/ /var/www/html/drupal

Step 6 : change to directory /var/www/html/drupal/sites

cd /var/www/html/drupal/sites

Step 7 : List the Dir/Files in /var/www/html/drupal/sites

[root@localhost sites]# ls -l
total 16
drwxr-xr-x 4 6226 6226 4096 May  8 09:35 all
drwxr-xr-x 2 6226 6226 4096 May  8 09:35 default
-rw-r--r-- 1 6226 6226 2365 May  8 09:35 example.sites.php
-rw-r--r-- 1 6226 6226  904 May  8 09:35 README.txt
[root@localhost sites]#

Step 8 : Copy default directory to your domain name

Now copy the directory called default and give copied directory name with your domain name.Here, I am using the domain name example2.com . This will be your site directory.

[root@localhost sites]# cp -prvf default example2.com

Step 9 : Rename default.settings.php file

Rename the file called default.settings.php to settings.php . This file is located inside site directory which has your domain name.(As per tutorial, it is in example2.com)

[root@localhost sites]# mv example2.com/default.settings.php  example2.com/settings.php

Step 10 : Create directory called files inside site directory

[root@localhost sites]# mkdir -p example2.com/files

Step 11 : Change ownership and group of Drupal directory

Change the ownership and group with apache to Drupal directory

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

Create MySQL Database,user name for Drupal sites

Lets restart the MySQL server . If it is your fresh installation of MySQL server on system, we will recommend you to run the command mysql_secure_installation . By running this command, you can set root password and secure your server in some aspects.

Now after root password is set, follow the given below commands to create database for each site.
Here, we have two sites with following details-

Site 1: exmaple.com
Database name for site 1 : example
Database username for site 1 : exampleuser
Password set for database user : Password (Change password of your wish)

Site 2: example2.com
Database name for site 2 : example2
Database username for site 2 : example2user
Password set for database user : Password (Change password of your wish)

mysql -u root -p
After login you will get the mysql prompt like this
mysql >
Now create a user and set the password. Use strong password
mysql> CREATE USER 'exampleuser'@'localhost' IDENTIFIED BY 'Password';

mysql> create database example;

mysql> GRANT ALL ON example.* TO 'exampleuser'@'localhost';
mysql> flush privileges;

mysql> CREATE USER 'example2user'@'localhost' IDENTIFIED BY 'Password';

mysql> create database example2;

mysql> GRANT ALL ON example2.* TO 'example2user'@'localhost';
mysql> flush privileges;
mysql> exit

Configure Apache HTTP Server for Drupal Sites

Now we are configuring Apache HTTP Server for Drupal Sites.
First take the backup of httpd.conf file. In case any problem happen you can revert back.


cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.`date +%F`

Here we are configuring here Name Based Virtual Hosting

First, search the keyword NameVirtualHost in httpd.conf file . Then make it enable by removing # from the front of line.Make it available for all domain at port 80.Like given below

NameVirtualHost *:80

Now paste the below given code in last line of httpd.conf file. You can make changes as per your requirement


    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/drupal
   ServerName example.com
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common


    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/drupal
   ServerName example2.com
    ErrorLog logs/example2.com-error_log
    CustomLog logs/example2.com-access_log common

Now restart the apache http service

service httpd restart

Installing Drupal sites with web interface

Installing drupal sites is easy through web interface. Be ready with informations like Database name, database user name and its password.
In screenshots it is quite visible to see the credentials which we are going to use.

Open the web browser(chrome/firefox). In address URL field, write the domain name which you want to install.
As per our practical, we are installing example2.com first.
Below given screenshots are step by step

Install your first drupal site

drupal-example-1

drupal-example-2

drupal-example-3

drupal-example-4

drupal-example-5

drupal-example-6

Now logout from the drupal dashboard. And just simply type your domain name.(here we are opening the site example2.com, I have changed the theme to make some differentiation in two sites.)
This how it appears-
example2-site

Install your second drupal site

The steps are same for all. Now we have to open the next drupal site name which we want to install.
Here, in this case we are installing now example.com
Use only MySQL credentials for example.com . Read the section,”Create MySQL Database,user name for Drupal sites”

Below given is the step by step installation with screenshot.

drupal install

example-drupal-2

example-drupal-4

example-drupal-5

example-drupal-6

example-drupal-7

Logout from drupal dashboard. After loging out, simply open your domain name. Here as per practical we are opening example.com

example-site

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install mod_proxy and setup reverse proxy in Apache Ubuntu
  2. Setup Master Slave Chroot BIND DNS in CentOS 6 or Red Hat 6
  3. Setup MySQL master slave replication in CentOS 6
  4. CentOS 7 / RHEL 7 : Install and setup samba server ( file sharing)
  5. Install and setup maven in Linux for Jenkins
  6. How to install apache webserver in CentOS and Red Hat
  7. How to install mod_fcgid on CentOS and RHEL
  8. Install pagespeed module ( mod_pagespeed ) on Apache Web Server : CentOS / RHEL
  9. How to find CentOS Linux release version on CentOS 7 series
  10. How to upgrade to CentOS 6.6 from CentOS 6.x series

Filed Under: Apache, Linux Tagged With: drupal, webserver

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Linux Commands

How to extract RPM package on Linux system

Learn tar command and know about its precaution

smbpasswd command not found on CentOS 7 and RHEL 7

rsync over ssh port number on Linux/Unix system

grep command to remove commented lines

create a system account below uid 500 on RHEL/CentOS/Scientific Linux

cat,sed and awk commands to display file contents

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

linux release renew dhcp assigned ip address

Convert hyphen to underscore in between all filenames shell script

How to configure ethernet in CentOS 6 after installing in Virtual Box

Do not show line haveing particular keyword by grep command

Error installing rails

send email after mysql backup through bash script in simple way

How to reset forgot root password in CentOS 6.x and Redhat 6.x

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands For Every Beginner

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy