Last updated 4 September 2015. Created on 24 April 2007.
Edited by dhwani.addweb, vlahonick, 2020media, devinwhite717. Log in to edit this page.

Multisite 10 minute Install:

  • Server: LAMP
  • SSH (telnet) Client: ssh (PuTTY if you are using Windows to access your LAMP host)
  • Must have root access to your server.

If website in question is an addon domain, i.e.,, then substitute "addon" for "www" in steps below.

For list of Linux commands visit:, or

Here we go:

[login via ssh / PuTTY]

Debian (Ubuntu)

Debian and offshoot distributions (e.g. Ubuntu) make installation and configuration very easy. This was done on a Debian distribution, Ubuntu should work identically.


Assumption: apache2 and mysql are already installed. If not, use apt-get install to install and configure them.

# apt-get install drupal 6

Answer the questions. This will install everything necessary to run drupal and do the basic configuration, including creating an empty database for drupal.

  • Configure database for drupal 6 with dbconfig-common? [YES]
  • Database type to be used by drupal 6: [mysql]
  • Password of your database's administrative user: [enter mysql root password]
  • MySQL application password for drupal 6: [create a password for your drupal 6 db]
  • (enter the password again for verification)

You now have a basic unconfigured Drupal 6 installation using the database drupal 6 and accessible at 6. Do not use it. This is the "prototype" installation that we will use to create the sites we really want to use.

Create Site Databases

The easiest way to create databases for your sites is to use dpkg-reconfigure and answer the questions.

# dpkg-reconfigure drupal 6

  • Re-install database for drupal 6? [YES]
  • Database type to be used by drupal 6: [mysql]
  • Connection method for MySQL database of drupal 6: [unix socket]
  • Name of your database's administrative user: [root]
  • Password of your database's administrative user: [enter mysql root password]
  • username for drupal 6: [ENTER YOUR DB SITE *USERNAME* HERE (e.g. mysite)]
  • database name for drupal 6: [ENTER YOUR DB *SITE* NAME HERE (e.g. mysite)]


  1. Repeat the above for each site you want to support.
  2. I used the same name for the database and the site. KISS.
  3. Don't use periods (e.g. is a bad choice). If you want to spell out the whole name, use underscores instead of periods (e.g. mysite_com).
  4. The above method ends up using the same site database password for all the sites you create. Advice: use mysql-admin (or mysql) to use different passwords for each site.

Configure Apache2 for Sites

Before you jump to configure your virtual hosts do not forget to add host names in /etc/hosts file.


Apache2 needs to be configured to support vhost access to your new sites.

Create vhost site configuration files in /etc/apache2/sites-available/

# Virtual hosting configuration for Drupal

<VirtualHost *:80>
	ServerAdmin [your email address]

	DocumentRoot /usr/share/drupal6/
	ServerName [your vhost#1 name]
	ServerAlias [if you want to support and]
	RewriteEngine On
	RewriteOptions inherit

<VirtualHost *:80>
	ServerAdmin [your email address]

	DocumentRoot /usr/share/drupal6/
	ServerName [your vhost#2 name]
	ServerAlias [if you want to support and]
	RewriteEngine On
	RewriteOptions inherit

[...repeat for all your vhosts]


  • Modify the above items that are in [square brackets].
  • You likely will want to support port 443 (https) as well. See Apache documentation for detailed instructions.
  • I've chosen to put all the vhosts in one file named drupal. You may want to use one file per vhost.

Sym-link the drupal file in the sites-enabled directory to enable it in your site:

# cd /etc/apache2/sites-enabled
# ln -s ../sites-available/drupal .

...and reload Apache2 to pick up your configuration changes...

# /etc/init.d/apache2 reload

Create Drupal Site Configurations

We need to create Drupal configurations for each site by copying the default configuration to the Drupal site subdirectory.

# cd /etc/drupal/6/sites/
# cp -a default []
# cp -a default []

...and edit the configurations to use the right database, MySQL user name, and password...

# vi 
# vi 


  • Modify the above items that are in [square brackets].

Run Drupal and Configure Your Sites

Browse to your sites, running install.php (e.g. to configure them.


Get to location where Drupal core will be located:

[/]# cd /var/www

Upload Drupal core:

"x.x" should be replaced with the version of Drupal you're installing, e.g. "5.2"

[/var/www]# wget

Unpack Drupal core:

[/var/www]# tar -zxvf drupal-5.2.tar.gz

Move contents of Drupal core (including .htaccess) to html:

[/var/www]# mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html


[/var/www]# rm drupal-x.x.tar.gz

[/var/www]# rm drupal-5.2

Create the files directory per Drupal instructions and change permissions (will change permission again after install):

[/var/www]# cd html

[/var/www/html]# mkdir files

[/var/www/html]# chmod 777 files

Make directories that will hold custom and contributes modules and themes:

[/var/www/html]# cd sites/all

[/var/www/html/sites/all]# mkdir modules

[/var/www/html/sites/all]# mkdir themes

[/var/www/html/sites/all]# cd modules

[/var/www/html/sites/all/modules]# mkdir custom

[/var/www/html/sites/all/modules]# mkdir contrib

[/var/www/html/sites/all/modules]# cd ../

[/var/www/html/sites/all]# cd themes

[/var/www/html/sites/all/themes]# mkdir custom

[/var/www/html/sites/all/themes]# mkdir contrib

Create directory "":

[/var/www/html/sites/all/themes]# cd ../

[/var/www/html/sites/all]# cd ../

[/var/www/html/sites]# mkdir

Change permission of "settings.php" per Drupal instructions and copy "settings.php" in default to

[/var/www/html/sites]# cd default

[/var/www/html/sites/default]# chmod 777 settings.php

[/var/www/html/sites/default]# cd ../

[/var/www/html/sites]# cp -a default

Create database and user with permissions:

[/var/www/html/sites]# mysql

mysql> CREATE DATABASE wwwexamplecom_drupal;

mysql> GRANT ALL PRIVILEGES ON wwwwexamplecom_drupal_drupal.* TO 'wwwexamplecom_drupal_myusername'@'localhost' IDENTIFIED BY 'mypassword';

mysql> \q

Go back to PuTTY to chmod on settings.php in

[/var/www/html/sites]# cd

[/var/www/html/sites/]# chmod 755 settings.php

[/var/www/html/sites/]# logout

What next?:

  • Make changes to "settings.php" in I've read that it's not necessary to make changes to setting.php.
  • Make changes to "httpd.conf" in /usr/local/apache/conf?

I've been using WHM to create accounts, putting Drupal in public_html and having no problems. But when it comes to parting from the WHM abstraction and getting multisite set-up correctly this is the end of the proverbial road for me.

Could use help...:

  1. Help making improvements to steps articulated above
  2. Help with next steps so that I/we can get on to grander things, like creating modules, custom themes, profiles, (and maybe - just maybe - spend some time working on business strategy :-)

Looking for support? Visit the forums, or join #drupal-support in IRC.


perspectoff’s picture

Multi-site Installation for Drupal6/Ubuntu Jaunty -- what I did August 2009

If you intend to run multiple websites, using a single Drupal6 installation, then follow these instructions carefully. I could only get this to work if each site had its own domain name, e.g and (I could not get it to work for and In brief:

* Install, but do not plan to use, the first (default) Drupal6 installation:

sudo apt-get install drupal6

It will ask for your MySQL password -- use the MySQL root password you set when you installed MySQL initially (as part of your LAMP installation, for example). This will install an initial MySQL database named drupal6. You will be asked for a new password for this drupal6 database, which you can make different than your MySQL root password, if you wish.

* Now you will re-install a new database for each planned subsite.:

sudo dpkg-reconfigure drupal6

* Re-install database for drupal6? [YES]
* Database type to be used by drupal6: [mysql]
* Connection method for MySQL database of drupal6: [unix socket]
* Name of your database's administrative user: [root]
* Password of your database's administrative user: [enter mysql root password]
* username for drupal6: [ENTER YOUR DB SITE *USERNAME* HERE (e.g. mysite_x_adminuser)]
* database name for drupal6: [ENTER YOUR DB *SITE* NAME HERE (e.g. mysite_x)]

You will have created a new database with a database user name for each subsite (I used a username identical to the database name to make it easy to remember). The password will be the same as your initial database (i.e. drupal6) password, by default.

* Next you will copy the "default" site folder to a folder for each subsite. Each subsite folder must be named in a convention that is peculiar to Drupal. If your subsite will be reached from the web as, then name the folder

* If you are using

cd /etc/drupal/6/sites/
cp -a default

* (Optionally), copy the themes and modules from the core installation folder to your subsite folder, so you can customize them without changing the core installation:

cp -a /usr/share/drupal6/modules/ /etc/drupal/6/sites/
cp -a /usr/share/drupal6/themes /etc/drupal/6/sites/

* Erase the symbolic link for the files folder (copied with the rest of the default folder) and make a new folder for uploaded files. If you want all your subsites to use the same uploaded files, omit this step.

sudo rm /etc/drupal/6/sites/
mkdir /etc/drupal/6/sites/

You may need to make the files folder readable to allow installation to proceed without an error (many users use chmod 775 or even chmod 766):

sudo chmod 777 /etc/drupal/6/sites/

* Edit the configuration files to make sure it correctly reflects your newly created database variables (that you entered in the previous installation step), such as database name and database user. Leave the password alone.

sudo nano /etc/drupal/6/sites/

Repeat this process for each new subsite. Replace with the name of each subsite.

* Files, themes, and modules to be shared by all subsites should go in the "all" subsite. (this is an optional step, but if you don't, then the core installation modules and themes folders will be used for common files. If you modify any of the core installation modules or themes, they will be overwritten at the time of an upgrade). Copy the code folders:

sudo cp -a /usr/share/drupal6/modules/ /etc/drupal/6/sites/all
sudo cp -a /usr/share/drupal6/themes /etc/drupal/6/sites/all

and (optionally) make a directory for shared files:

mkdir /etc/drupal/6/sites/all/files
sudo chmod 777 /etc/drupal/6/sites/all/files

* Create a virtual host file for the new sites:

sudo nano /etc/apache2/sites/available/drupal6

Add the lines:

# Virtual hosting configuration for Drupal

DocumentRoot /usr/share/drupal6/
#RewriteEngine On
#RewriteOptions inherit


ServerAdmin [your email address]
DocumentRoot /usr/share/drupal6/
#RewriteEngine On
#RewriteOptions inherit

Note that I hashed out (commented out) two commands that didn't work (regarding RewriteEngine) in my installation of apache2. You may want to play around with other settings, if you are comfortable with virtual host files.

* To activate the virtual hosts, make a symbolic link from the apache2 sites-available folder to the sites-enabled folder:

sudo ln -s /etc/apache2/sites-available/drupal6 /etc/apache2/sites-enabled

* Restart apache2:

sudo /etc/init.d/apache2 restart

* Install each of your new Drupal subsites independently:


Now you have two separate sites. When it is time to upgrade, you will only have to upgrade the core Drupal installation.
[edit] Multisite cron

Refer to these instructions. I can add the task(s) to my cron list:

sudo crontab -e

And add the lines (with the nano editor, or the one you prefer):

45 * 18 * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php
45 * 19 * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php
45 * 20 * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php

this will run the scripts separately, at 45 minutes after the 1800 hour, the 1900 hour, and the 2000 hour every day (each site at a different hour).

If you want all the cron scripts to run every hour, then stagger them:

0 * * * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php
20 * * * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php
40 * * * * /usr/bin/wget -O - -q -t 1 http://''''/cron.php

this runs one script on the hour (0), one script at 20 minutes past the hour, and one script at 40 minutes past the hour.

Alex Sutcliffe’s picture

Thanks people, this was exactly what I needed as someone comfortable with LAMP on Debian but a complete Drupa newb.

toypilot’s picture

Have I read that correctly, you need 3 databases? If so what if you already have an site install and want to add another seperate database and site?

perspectoff’s picture

The example creates 3 databases, but the first database is the one used for the "default" user. I generally do not use it because each time I do a "dpkg-reconfigure drupal6" the settings for the default user change.

To save myself headache, I just let this happen and don't use the first (default) database. Since it is mostly an empty database, it does not take much space. This is a safety valve, of sorts.

The other two databases are the ones I use for my real subsites.

In the example there are two subsites and three databases. For 5 subsites I would create the default database and 5 additional databases, or 6 databases total.

While it is possible to run multiple sites with a single database (using table headers and so forth), I find that to be a complex exercise fraught with difficulty which for me requires lots of fiddling with the database to avoid conflicts. Since MySQL is fairly compact I find it is easier to simply create one database per subsite (and not worry about conflicts).

As to adding more subsites to an existing installation, there are a few quirks. Here's what I do:

Move (not copy) the default folder to a new subsite folder, just like in the instructions above.

Create the new database for the new subsite using dpkg-reconfigure drupal6, as outlined. A new /etc/drupal/6/sites/default folder with settings ought to be created. Now copy this new default folder to the second subsite folder (following the instructions above).

The difficulty for me then arises if I have previously installed modules and themes in the /etc/drupal/6/sites/all folder.

Drupal6 doesn't like to see any custom modules or themes when it does a new installation, so before I proceed with installation I rename the /etc/drupal/6/sites/all/modules and /etc/drupal/6/sites/all/themes folders to /etc/drupal/6/sites/all/modules.bak and /etc/drupal/6/sites/all/themes.bak prior to the installation of my new site.

Once the full installation is complete, I then rename them back to their originals (so that they can be discovered and used by the new subsite(s) as well).

jeff.hines’s picture

The parts in your configuration regarding RewriteEngine did not work possibly because you didn't have mod_rewrite enabled in Apache2.

thisnameagain’s picture

Thanks for the tutorial, for some reason all the others just did not work but this one did. I appreciate it. Real simple and now I have multiple websites hosted from one drupal install.

bht333’s picture

This is very helpful.

I tried to automate this with partial success:

Edit new site parameters:
# vim /etc/dbconfig-common/drupal6.conf

Preseed the debconf database with a database admin password
# echo -e "drupal6 drupal6/mysql/admin-pass password adminpass" | debconf-

Configure new site
# dpkg-reconfigure -f noninteractive drupal6

This creates a good dbconfig.php but no database :(

Could someone please help me out?

sridharpandu’s picture

I wanted to have this for my dev. environment and hence I tried this on my laptop.

My vhost configuration is as follows


DocumentRoot /usr/share/drupal6/
# ServerAlias
RewriteEngine On
RewriteOptions inherit


DocumentRoot /usr/share/drupal6/
# ServerAlias
RewriteEngine On
RewriteOptions inherit

Created the symbolic link in the sites-enabled directory.
Restarted Apache
Created folders and under /usr/share/drupal6/sites/
I am unable to execute the last step

Browse to your sites, running install.php (e.g. to configure them.

Its strange that in my installation I find the install.php in the /usr/share/drupal6 directory and not in the /usr/share/drupal6/sites/default directory.

Need some help to get this done.



Acer Aspire 5745
[i5 430M, 3GB, 320GB]
Ubuntu 12.04 (Precise Pangolin)
Drupal 6.15, 7.x
DigitalOcean, Go Daddy, Rackspace,

kennyk’s picture

Since, per the instructions, the DocumentRoot of both vhosts is /usr/share/drupal6, running both and will run the same script; should I make separate copies of /usr/share/drupal6 for each hosted domain? Does anything else need to be configured in this case? For example, I'd like separate admin logins for each domain. Please advise on how to proceed.


kennyk’s picture

Not sure if this is right, but here's what I did

1) Created two separate databases for each site using dpkg-reconfigure, using the names site1_com and site2_com. Remember what you enter here for the db and user names - you will need this later.

2) Created a copy of /usr/share/drupal6 for site1_com and site2_com. In my case, I placed them in /var/www/ and /var/www/ Make sure to point DocumentRoot for each vhost in your Apache config to the corresponding site. I did mine in httpd.conf:

NameVirtualHost 111.22.333.44:80

ServerAlias *
DocumentRoot /var/www/
RewriteEngine On
RewriteOptions inherit

ServerAlias *
DocumentRoot /var/www/
RewriteEngine On
RewriteOptions inherit

3) Changed the sites/default/dbconfig.php in each copy to use the database and db user name provided in step (1) - each site should point to its own database.

4) Make sure the permissions on the dbconfig.php files are set properly - if you get problems, you can enter
chrown www-data:www-data dbconfig.php to give Apache the rights it needs.

5) In a browser, navigate to and - you should be all set!

Disclaimer - I'm completely new to Drupal, so if this setup, for some reason, leads to something awful down the road, I hereby disavow all responsibility ;)

BradleyT’s picture

The steps you took are the steps you would take to get 2 sites running on a web server (wouldn't have to be Drupal sites) and has nothing to do with a drupal multi-site installation. You basically replicated all of the folders and files and copied them to 2 installations - that defeats the purpose of a multi-site Drupal install. The whole purpose is one set of code, one group of modules, many sites.

sdk’s picture

Hello, if i type apt-get install drupal6 I get a 'E:Couldn't find package drupal6' error. Do i have to add / enable extra repositories to make this work?

I know how to handle a manual install, yet, i wondered what happened to the usual smooth apt-getness?

Update: I am running on an Ubuntu Hardy 8.04 VPS and had to realize that drupal6 is not available in the Packages only drupal5 ://

Anybody having more info?

kvvnn’s picture

I had to add the following to my /etc/hosts file in Ubuntu 9.04 mysubsite

I'm not sure if this is standard (a lot of these HOWTO's seem to leave this out), and would appreciate some feedback on whether this should be necessary.

bht333’s picture

Why so much writing and confusion about such a simple thing? Nobody seems to know how to do this right. That is because the only way to do this right is broken and the whole procedure as outlined at the top contains a workaround for an unfixed security issue:

'dpkg-reconfigure drupal6' inherits the old user password for a new database

After that is fixed, one needs to only create new configurations - no need to manually "...and edit the configurations to use the right database, MySQL user name, and password..." as outlined.

lockev3.0’s picture

It seems main problem is to configure isolated DBs (me I use just a phpmyadmin as I am upon a CentOS).
But, sorry if this is to basic question, how do I really access to the different sites in my remote server? Apache reverse-proxy? who does the right redirection to adecuate settings.php from requested URL ? ....

peterpoe’s picture

For people on shared servers without terminal access: you can create a symbolic link with a simple php script uploaded with ftp:

  symlink('TARGET', 'LINK_NAME');

To figure out the right path, you can use the function getcwd(). In my case, the path was:

  symlink('/web/htdocs/DOMAIN/home/drupal', '/web/htdocs/DOMAIN/home/drupal/SUB_SITE_FOLDER');