I have an existing instance of D7 in a multisite configuration on RedHat.

Can I use drush si to create a new database and /sites/ instance -- without altering any existing subsite? Is there a way to automate this?

I'm envious of Wordpress Networks' ability to spawn up a new site inside the admin console.

In my current process, I create a database on local systems.

mysql> create database nominations;
Query OK, 1 row affected (0.01 sec)

mysql> grant usage on nominations.* to nomnom@localhost identified by 'Sup3rS3cr3tP455w04d';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on nominations.* to nomnom@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

Sudo and edit the alias.conf file

$ sudo su
# vim /etc/httpd/conf.d/alias.conf

In that file add the alias. The current file reads as such. The idea is to point all aliases to the drupal root. Let drupal handle routing based on folder entries inside its /sites/ folder.

 Alias /nomination /var/www/html

Once this file is saved. Restart the server.

# service httpd restart

# exit 

Now the database is created and apache has a new alias. Create a new folder inside of /sites/ in the fashion drupal routing will recognize (server.name.path). Create a symlink to make drush maintenance easier.

$ mkdir nomination
$ cp default/default.settings.php nomination/
$ cd nomination
$ mv default.settings.php settings.php

At this point I go to server.com/nomnination and run the typical install process. After and back on the command line, coordinate a bit of module goodness:

$ drush en -y coffee module_filter jquery_update bootstrap

$ drush dis -y overlay

2 Answers 2


A lot can be done with just drush si:

--sites-subdir: install in a subfolder of /sites (defaults to 'default')

--db-url: if the database is not found, it will try to create the database

--db-su and --db-su-pw to supply a user who can create the database, but will not be set in settings.php

$ drush si --db-url=mysql://nomnom:Sup3rS3cr3tP455w04d@localhost/nominations --db-su=root --db-su-pw=dbrootpwd --sites-subdir=nomination

And then do the general module goodness.

  • So as long as I have the --sites-subdir there, existing databases (of the other multisites) are safe?
    – Rick
    Jan 15, 2015 at 17:37
  • Yes, nothing will be changed to the other sites. Jan 16, 2015 at 19:08

If you configure multisite instances to use https://www.drupal.org/project/dslm, you can use a command like 'drush dslm-new mynewsite drupal-7.34' to provision a new site. @btopro has taken DSLM a step further calling DSLM and Drush commands from the CIS install profile to completely automate the process from within Drupal for Penn State and the growing number of schools using ELMS. This configuration allows schools to generate several new Drupal sites from different ELMS install profiles from a centralized Drupal site. [This screencast][1] explains how the ELMS CIS implementation works. There is also a vagrant version of this configuration you can spin up from https://github.com/btopro/elmsln-vagrant

CU Boulder also uses a Drupal front end to DSLM to spin up new sites, but we don't use a true multisite configuration and our backend for this service is more complicated and CU specific leveraging Eve (http://python-eve.org) and F5 server (https://f5.com/products/modules/global-traffic-manager).

I doubt either of these solutions is a good fit for you out of the box, but if the "automated way" you are only looking for only needs to automated this process at a commandline level, DSLM will get you most of what you need. You can also use code from the ELMS CIS project to create your own front end.

If you looking for a graphical front end that works "out of the box", you might want to consider using the Aegir Project (http://www.aegirproject.org/) with an install profiles like Hostmaster (https://www.drupal.org/project/hostmaster). Installing Aegir on your own server can be complicated (http://community.aegirproject.org/installing/manual), but there are several hosted Aegir options. Converting an existing site to Aegir is also more complicated than DSLM. Aegir is really an "all in decision" while DSLM can be used along side existing, non-DSLM sites and includes a command to convert an existing site to use the DSLM symlink structure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.