How to install Drupal using Drush

This article assumes you have Drush installed and you're in a LAMP environment. If you don't have Drush installed, there are plenty of good articles out there. For those running Ubuntu, you can install Drush using apt-get:

$ sudo apt-get install drush

To setup a Drupal site, regardless of the method, you need to do the following:

  • Setup a new MySQL database
  • Setup a new Apache entry
  • Download a copy of Drupal
  • Extract Drupal to a directory on your web server

You can handle the last two with Drush and that what we'll cover here. For our purposes, let's say you created a new database called mysite_com and a new Apache entry that points to your Drupal instance (e.g. /var/www/mysite.com )

Step 1: Navigate to the directory where you want Drupal installed

For me, I put mine under my www directory:

$ cd /var/www

Step 2: Download Drupal with Drush

You can download Drupal with the following command:

$ drush dl drupal

There are a few things to note here. First, this will download the latest recommended version of Drupal. If you want a different version, you can specify that like so:

$ drush dl drupal-7.12

When downloaded, the site will be placed in a directory named after the Drupal version (e.g. drupal-7.12), so you may wish to rename it. For example to rename it to mysite.com:

$ mv drupal-7.12 mysite.com

Step 3: Install the Drupal site

You have two options here:

Option #1: Install the site using Drupal's installation wizard.

To do that, simply navigation to your new Drupal install in your web browser.

Option #2: Install the site using Drush:

drush site-install standard --account-name=admin --account-pass=[user_pass] --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name]

Done!