Wednesday, September 3, 2014

CentOS : Install and setup multisite drupal on CentOS 6.5

Install and setup multisite drupal on CentOS 6.5

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).

Step 2 : Install PHP and required php modules

Step 3 : Download drupal package

Download latest drupal package from Drupal site .
By using wget command, we are downloading the drupal package
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.

Step 5 : Rename the extracted out drupal directory

Rename the directory which is extracted out from untar command.

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

Step 7 : List the Dir/Files in /var/www/html/drupal/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.

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)

Step 10 : Create directory called files inside site directory

Step 11 : Change ownership and group of Drupal directory

Change the ownership and group with apache to Drupal directory

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)

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.
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
Now paste the below given code in last line of httpd.conf file. You can make changes as per your requirement
Now restart the apache http service

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

No comments: