Main content

Main content of the site. All will soon be moved into the blog section.


Drupal Stuff :: Drush Shell Scripts for Creating Drupal Sites

 diversen (24-Feb-2010 13:39:28)

Download And Install

I moved these scripts to github some time ago. You can find the latest version on Best option is to cd into your drush/commands folder, and clone the script:

 git clone git://

then they are installed. You can use the master or select latest tag.


The following scripts are tested and working on Debian systems MySQL and Postgresql is supported. The densite scripts creates virtual host configuration and drupal-5.x and drupal-6.x, drupal-7.x sites (most testing is done with drupal-6.x). It also updates your /etc/hosts file with installed site. It can also 'curl' a default user so you don't have to use the browser. This only works on drupal-6.x

The script also secures your site by setting good permissions for your file folder and your settings.php file. The default configuration will also delete all .txt files. Finally crontab will be updated.


  • Access to creating crontab entries
  • a2ensite
  • a2dissite
  • drush-All-Versions-2.0.tar.gz Or later.
  • Or any later version should work.
  • PHP, Apache2, MySQL or PostgreSQL
  • sudo (and root privileges) (on other Debian you may need to do

    su root

  • Access to creating databases (MySQL or PostgreSQL or both)


For configuration you can look at the following two files and change them as needed. Else they will just be created from the default config files:



If you yet does not have a working drupal install, you can use the densitein (densite install) command which will prompt for a version to download and install. The version you download will be installed in your current working directory. E.g. make a www directory in your home folder, e.g:

mkdir /home/user/www && cd /home/user/www
drush densitein

(You will not be able to visit the real after this, because /etc/hosts now has this domain.

To create a sub site in a install of drupal. cd to the document root of your newly installed site, e.g.:


Create and enable a subsite use:

drush densite

The name your are using will be used as the ServerName in your VirtualHost configuration. The name will figure as the site name in the sites/ folder, e.g. sites/ for the above example. It will also be used as the apache2 virtualHost configuration placed in /etc/apache2/sites-available folder. If you choose to let the densite script generate a database name, then the name of the database will be devoscmsnet (the site's name without any special signs). Created log files for apache2 will be placed in (from your current drupal document root view):


Delete the newly created subsite:

drush dissite

Deletes database for website, log files, apache2 virtualhost file and reloads apache2 and removes the site files, and removes the crontab entry, step by steep.

In order to create and enable a new (s)tand(a)lone or base install:

cd to document root of your site, e.g:

cd /home/user/www/
drush densitesa

Notice the name of the command. It is just densite ending with 'sa' (standalone). You can clone the current site or you can download a version of drupal of your choice. You will be prompted for the version you wish to download. The new site will be created like this (from your current drupal document root view:)


Notice That a base install creates a folder called htdocs containing the new base site. Log files will also be created as in the densite command:


Delete a (s)tand(a)lone drupal install:

drush dissitesa

In order to delete a standalone or base site all sub sites needs to be deleted first. For each of the standalone code bases you can use the densite command for creating new sub sites. Or the dissite command for deleting them.

List all sites installed with the densite, densitesa, and densitein commands. You have to stand in a directory containing a base install, e.g. in:

cd /home/user/www/

And do a:

drush listsites


You can use the following flags:


flag to see what the commands will do to your system. When using simulate there will be no changes to your system.


Force the script to continue when errors are encountered. E.g.: You have tried to install a site but your failed halfway due to permissions. You can then change the permissions on your server, and force the script to execute.


Silence the script will produce less output, and only prompt you when questions are raised.

This page has been viewed 2837 times. First hit: 30-Oct-2015 18:44:58
Share email, Google+, Twitter, Facebook.


Add new comment