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 5.x or 6.x

Preparation

  1. Go to the Dreamhost Control Panel and create 2 or more domains or subdomains to use Drupal on.
    • For the purpose of these instructions we are going to use domain.com, sub1.domain.com and sub2domain.com. (You can make as many sub.domain.coms as you would like.)
  2. 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://drupal.org/files/projects/drupal-5.7.tar.gz in the terminal. You should download a file called drupal-5.7.tar.gz.
  3. type tar -xvzf drupal-5.7.tar.gz . A list of files should be unpacked into a directory called drupal-5.7 .
  4. Move the contents of drupal-5.7 to your main domain that you'll be using to house the codebase, we'll use domain.com as the main codebase. Move the contents by typing mv drupal-5.7/* domain.com . Also type mv drupal-5.7/.htaccess domain.com to make sure you get the hidden .htaccess file.
  5. Now you can remove drupal-5.7.tar.gz by typing rm drupal-5.7.tar.gz and you can remove the drupal-5.7 directory by typing rm -r drupal-5.7 .
  6. Now we need to remove sub1.domain.com and sub2.domain.com. Type rm -r sub1.domain.com and rm -r sub2.domain.com .
  7. The next step is to create symbolic links from your codebase to your subdomains (or alternate domains). Type ln -s /home/username/domain.com/ /home/username/sub1.domain.com (there is a space between the / /) and ln -s /home/username/domain.com/ /home/username/sub2.domain.com .
  8. The final thing that needs to be done is to create directories for your multiple sites. Navigate to your sites folder by typing cd domain.com/sites/ .
  9. Copy the default directory by typing cp -R default/ sub1.domain.com . This also changes the name of the copy to sub1.domain.com.
  10. Create another directory for sub2 by typing cp -R default/ sub2.domain.com
    • 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 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 all/modules and mkdir all/themes. If you want to make a themes and modules directory for your subdomains, replace all with the other directory names.
  11. You can now quit out of the terminal
  12. Open your web browser of choice and navigate to domain.com.
  13. 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 .



  14. You should now see a Installation Complete page. You might want to continue to your new site and create your first user.
    Drupal Install
  15. 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.
  16. Viola!




Personal tools