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
* 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.
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
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).
Database Server = MySQL
wget(command) is for downloading the package(drupal).
1
|
yum install httpd mysql-server wget
|
Step 2 : Install PHP and required php modules
1
|
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
By using wget command, we are downloading the drupal package
1
|
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.
1
|
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.
1
|
mv /var/www/html/drupal-7.28/ /var/www/html/drupal
|
Step 6 : change to directory /var/www/html/drupal/sites
1
|
cd /var/www/html/drupal/sites
|
Step 7 : List the Dir/Files in /var/www/html/drupal/sites
1
2
3
4
5
6
7
|
[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.
1
|
[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)
1
|
[root@localhost sites]# mv example2.com/default.settings.php example2.com/settings.php
|
Step 10 : Create directory called files inside site directory
1
|
[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
1
2
|
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-
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)
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)
Database name for site 2 : example2
Database username for site 2 : example2user
Password set for database user : Password (Change password of your wish)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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.
First take the backup of httpd.conf file. In case any problem happen you can revert back.
1
|
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
1
|
NameVirtualHost *:80
|
Now paste the below given code in last line of httpd.conf file. You can make changes as per your requirement
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<VirtualHost *:80>
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
</VirtualHost>
<VirtualHost *:80>
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
</VirtualHost>
|
Now restart the apache http service
1
|
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.
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
As per our practical, we are installing example2.com first.
Below given screenshots are step by step
Install your first drupal site
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-
This how it appears-
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”
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.
Logout from drupal dashboard. After loging out, simply open your domain name. Here as per practical we are opening example.com
No comments:
Post a Comment