Zero Configuration Multisite
grayside — Tue, 08/18/2009 - 10:29
This is a straightforward walkthrough to installing Drupal in multi-site "mode" without needing to make any configuration changes to your webserver. This tutorial assumes your webserver will follow symlinks.
Download Drupal
Download the latest Drupal release from http://drupal.org. Put it inside a directory named, say drupal_multisite. It does not need to be in the webserver's directories.
Create Your Sites Directories
Even if you are only going to start with one site, follow these steps.
- Go to path/to/drupal/sites
- Copy default/default.settings.php to default/settings.php
- Copy the default directory, name it www.example.com.site1. Repeat for site2, site3, and so on.
Set Up the Database
This section is only relevant if you have "root" access to the database. If you do not have this kind of access, request your system administrator give you a new database for each site. Your database account will need the following permissions:
If you are doing this yourself with that root access, login to MySQL and get to work.
Create the Database User
If necessary, create a database user as follows:
CREATE USER 'username' IDENTIFIED BY 'password';
Create a Database for Each Site
Each site needs it's own database. I suggest naming them something like multisite_sitename. In this example, I'm going drupal_site#.
CREATE DATABASE 'drupal_site1';
Grant the Database User Permission
The database user will need permission to do all the drupal-ish things on each database.
GRANT ALL ON
drupal_site1
.* TO 'username'@'localhost';Create Symlinks
Go to the drupal_multisite directory you created above to contain your current drupal installation, create a symlink from drupal_current to drupal-X.Y:
ln -s drupal-6.13 drupal_current
This allows you to upgrade Drupal Core and only need to change one symlink.
Next, make the webserver aware of your Drupal sites. Go to the root directory of your webpages. Create a symlink to the drupal_current symlink you just created from <site#>.
ln -s path/to/multisite_drupal/drupal_current site1
ln -s path/to/multisite_drupal/drupal_current site2Install Drupal
Go to www.example.com/site1/install.php. Follow the steps.
Next, go to www.example.com/site2/install.php
Done.