background image
HomeRecent PostsDrupalSearchTagsRSSContactAboutAccount

Using Drush to download contributed modules and setup a base Drupal installation

Eric.London's picture

Drush is a great command line module for administering a Drupal site. It's core features are listed here. Check out the README.txt for usage and installation documentation.

Drush can be used to setup a base Drupal installation with a few quick commands, awesome. One of it's biggest time saving features is downloading all the contributed modules when setting up a new site. Here are a few commands I use to setup a new Drupal site based on feature sets. The following commands should be run in the root directory of your drupal installation.

# Download development modules and themes:
drush dl admin admin_menu coder devel devel_themer reroute_email simpletest views_bulk_operations --destination=sites/all/modules/contrib/ --uri=http://yourhostname.com

# Download common/essential modules:
drush dl cck views date wysiwyg pathauto token captcha recaptcha location emfield link jquery_ui webform htmlpurifier luceneapi vertical_tabs --destination=sites/all/modules/contrib/ --uri=http://yourhostname.com

# Download SEO modules:
drush dl google_analytics xmlsitemap globalredirect site_verify --destination=sites/all/modules/contrib/ --uri=http://yourhostname.com

# Download structural/building modules:
drush dl context features ctools panels --destination=sites/all/modules/contrib/ --uri=http://yourhostname.com

# Download image handling modules:
drush dl imageapi transliteration filefield mimedetect imagefield imagecache imagecache_actions --destination=sites/all/modules/contrib/ --uri=http://yourhostname.com

NOTE: the destination and uri flags on the drush command are optional, but I recommend using them. In recent Drupal development I stopped using sites/default in favor of sites/hostname.com, to ensure that if I ever decide to move the site into a multi-site configuration, I will not have overlapping sites/default/files directories.

You can even enable the downloaded modules from the command line by using the "drush en" command..

drush help en

drush_make

Eric, thanks for the post. I've been using drush for some time now and I particularly like the drush extension drush_make.

It lets you build an entire drupal site from scratch by using a very simple script (easy for beginners, too).


# Download drush_make
drush dl drush_make

Then save the following file as YOURSCRIPTNAME.make.


; The following is mandatory
core = 6.x
projects[] = drupal


; The following is optional - a number of frequently used modules
projects[] = views
projects[] = cck
projects[] = pathauto
projects[] = date
projects[] = wysiwyg
projects[] = token
projects[] = emfield
projects[] = link
projects[] = webform
projects[] = admin_menu
projects[] = ctools
projects[] = panels
projects[] = admin
projects[] = devel
projects[] = coder

Then execute the following in your desired drupal directory.

drush make YOURSCRIPTNAME.make

Just connect the site with your database and voila, there's your drupal site.

Drush Make

You should check Drush make also. http://drupal.org/project/drush_make

--
Arshad

Drush version?

What version of Drush is this? 2 or 3? I had some issues with 3 and returned to 2 for now. I wasn't aware of a "drush en" command in Drush 2. I'll look into it.

Fun site design btw. I really like the pseudo-OSX desktop look and feel.

Couple features!

The quickest way to enable all the modules you download is to just click ^, change dl to en, and click enter to enable the modules.

Also, drush site-install can install a version of Drupal based on an installation profile.

You can also not use the uri and destination tags if you just cd to the directory you want them. Saves some typing in the long run.

Thanks for a great post Eric!

it would be great if we could

it would be great if we could download and config drupal core itself for the first time.