Drupal Multisite Install

From DreamHost
Jump to: navigation, search

These instructions are for people that want to run multiple Drupal sites but want to run them off of only one codebase. This allows for much easier module, theme and core upgrades.

Multisite Install with Drupal 6.x or 7.x

Preparation

  1. Go to the DreamHost Control Panel and a single domain to use Drupal on.
  2. Create this domain as fully hosted.
  3. Create 2 or more domains as "Mirrored" Domains sub1.domain.com and sub2.domain.com pointing to domain.com as the site to be mirrored
  4. *For the purpose of these instructions we are going to use domain.com, sub1.domain.com and sub2.domain.com. You can make as many sub.domain.coms as you would like or even use separate domains entirely on the same Drupal installation.
  5. Create 3 MySQL databases. We'll call them domaindb, sub1db and sub2db.

Installation

  1. open a terminal or putty or whatever you use to ssh to DreamHost.
    • You should be in your user directory. Type pwd and you should see /home/username where username is your personal username.
  2. type wget http://ftp.drupal.org/files/projects/drupal-7.19.tar.gz in the terminal. You should download a file called drupal-7.19.tar.gz.
  3. type cd domain.com && tar --strip-components=1 -xzf ../drupal-7.19.tar.gz . A list of files should be unpacked into a directory called domain.com which was created by the hosting script.
  4. Now you can remove drupal-7.19.tar.gz by typing rm ~/drupal-7.19.tar.gz .
  5. Copy the default settings.php by typing cp sites/default/default.settings.php sites/sub1.domain.com/settings.php .
  6. Create settings.php for sub2 by typing cp sites/default/default.settings.php sites/sub2.domain.com/settings.php
    • While you are here you can also take this time to create directories for your modules and themes. To add modules and themes to ALL your Drupal installs, create a modules directory and a themes directory in the sites/all directory. If you want to add modules and themes to only one domain or another, create a modules directory and a themes directory in the sub1.domain.com or the sub2.domain.com directories.
      • To create the directories type mkdir sites/all/modules and mkdir sites/all/themes. If you want to make a themes and modules directory for your subdomains, replace all with the other directory names.
  7. You can now quit out of the terminal
  8. Open your web browser of choice and navigate to domain.com.
  9. You should see a install/database configuration screen.
    Drupal Install
    1. You're probably using MySQL. Leave it at that.
    2. For database name fill in whatever name you chose. For this set of instructions we went with domaindb (for the main domain install).
    3. For username and password fill those in. (If you don't know this you're in trouble.)
    4. Click on Advanced Options
    5. For Database Host it will probably be mysql.domain.com where you replace domain.com with whatever is your registered domain.
    6. Leave Database Port and Table prefix alone. Unless you are running a multisite off of a single database you don't need to mess with these.
    7. Click Save Configuration .
  10. You should now see a Installation Complete page. You might want to continue to your new site and create your first user.
    Drupal Install
  11. Now point your browser towards your sub1.domain.com and sub2.domain.com and you'll have to walk through the installation pages for both sites. Fill them out and when you are done you will have a working Drupal multisite installation.
  12. Voilà!

See also