User login

Installing Drush

We are fTollowing our Debian-inspired sysadmin, Stefan Freudenberg, in the locations of this extra-Drupal project, but you can put it anywhere.

Remember to check the Drush project page for the latest version to wget, and replace the CURRENT-VERSION tarball link with that. This will be the last module you ever have to do that for.

cd /usr/local/share/
sudo mkdir php
cd php/
sudo wget http://ftp.drupal.org/files/projects/drush-CURRENT-VERSION.tar.gz
sudo tar -xzf drush-CURRENT-VERSION.tar.gz
sudo rm drush-All-Versions-2.0.tar.gz
sudo chmod u+x drush/drush
sudo ln -s /usr/local/share/php/drush/drush /usr/local/bin/drush
sudo drush --version

The last line does more than just show you the version, it will download anything else Drush needs to operate, which is why it needs sudo to put things in the usr (Unix System Resources) directory. You won't have to use sudo to use drush, just to update Drush itself.

A good place to put your extensions, drush alias files and the like, is your home .drush - ~/drush directory.

Then I changed directory to a Drupal install, cd /var/www/anjali (which is actually a symlink to /home/ben/code/anjali/drupal in my local environment) and attempted to run drush help. It failed with this error:

sh: curl: not found
Drush needs a copy of the PEAR Console_Table library saved as Drush [error]
includes/table.inc. Drush attempted to download this automatically,
but failed. To continue you will need to download the 1.1.3 package
from http://pear.php.net/package/Console_Table, extract, and move the
file Table.php to includes/table.inc.
Drush could not execute. [error]

That seemed like a lot of work, and noting how often we needed to use sudo since it was installed outside of my home directory, I tried sudo drush help and Drush was able to download and install its dependencies, no more fuss. From then on run drush from within your Drupal projects without sudo.

Searched words: 
Installing Drush 4.4 Installing Drush 2.0 drush pear Console_Table