Installing a distribution with Drush

  • Published by Alan
  • Filed under Drush, code

Installing a Drupal site is a slightly time consuming job when done manually, but incredibility fast and straight ward with Drush.

The first step is to ensure that you have a clean site directory and database1 ready for the installation. Once done, you simply need to download and then install via Drush

Step One: Download the distribution

Firstly, download the distribution. I do this by downloading this to a dedicated Drush download directory, and then cp or mv the files into the final web root. In this example, I am downloading the COD distribution (http://drupal.org/projects/cod) into the web root which is public_html.

mkdir drush-downloads
cd drush-downloads
drush dl cod
mv cod-7.x-1.0-alpha4 ../public_html

Step Two: Install the site

Change to that directory and run drush site-install

cd ../public_html
drush site-install cod --account-name=admin --account-pass=secret --db-url=mysql://DB_USER:DB_PASSWORD@localhost/DB_NAME

The --db-url parameter is the old Drupal 6 connection string, and an administrator user "admin" having the password "secret". Use the following command to see other options that are available.

drush help si

This process took less than one minute to download and install!

Your mileage will vary on a windows box. This same distribution was first installed on Windows using Drush. There were multiple errors seen during the install and the site was nearly unusable.

 

Notes
  1. You can also create the database during the installation process if you have the a known database user, with password, that can create databases. See the --db-su and --db-su-pw site-install options.

Comments

nice one's picture

Very helpful, cheers

Mark Young's picture

Good stuff- very helpful.
How can I direct the distribution to be installed in a folder other than public_html?

Add new comment