You are here

Command line Drupal install and update script for multi-site hosting

Maintaining a Drupal site, or a collection of sites is much easier if everything is kept completely separate--Drupal core, contributed modules, and the site itself.
This is even more important if multiple sites are hosted on the same server. Drupal's own multi-site support can be a nightmare to maintain, believe me! (e.g. when you want to upgrade modules or core).
A must simpler and easily supported configuration is to keep everything separate and to use symbolic links to tie it all together. For example, I keep:

  • a Drupal 5 install in /opt/drupal/drupal5
  • with Drupal 5 contrib modules in /opt/drupal/modules5
  • a Drupal 6 install in /opt/drupal/drupal6
  • with Drupal 6 contrib modules in /opt/drupal/modules6
  • sites typically live in home directories like /home/bluecorp/html

The site has no drupal code in it (except possibly custom code/themes in sites/default)
Instead, symbolic links are used to make it look as if Drupal code appears in all the expected places. This has the following advantages:

  • A site can be upgraded, simply by switching its links to a different install of Drupal
  • Upgrading a Drupal version is very clean, it is just dropped into its own folder
  • Multiple sets of modules can be kept and maitained
  • Backup is much easier
  • Just about all regular tasks can be automated, using a single script, provided below:

The code for this project has just been moved to http://sourceforge.net/projects/drupal-get

To get dget via subversion

Set the DGET variable below to the directory that will contain the dget utilities subdirectory and svn to download it:
DGET=/root/dget
svn co https://svn.code.sf.net/p/drupal-get/code/trunk $DGET
bash $DGET/setup.sh $DGET

It can be kept up to date using:
DGET=/root/dget; svn up $DGET; bash $DGET/setup.sh $DGET

Furthur installation notes

Can be found on the old project page at: http://drup.org/drupal-site-maintenance-using-symbolic-links

Topic: