Installing Drush on Ubuntu

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by manuel garcia on June 22, 2009 at 6:50pm

So, you probably have heard of drush, and maybe you have not tried it yet. I tried it quite a while ago, and found it to be somewhat of a hassle. But I yesterday I decided to give it another go, and see all the buzz everyone's talking about.

I use ubuntu at home, and using the console to manage drupal sites seems like ideal, yet I didn't think drush was ready yet... seems like I wasn't paying enough attention!

So now to the meat of it. You will have to change username for the name of your user of course.

  1. Download drush, and uncompress it to your home directory. In my case, this leaves the files inside /home/manuel/drush
  2. Make sure the permisions to the drush file are set so that you can execute the file. See the screenshot below:
  3. If only you will be using the script, make a symbolic link to this file in your /home/username/bin (create the folder if you haven't already):
    ln -s /home/username/drush/drush /home/username/bin/drush
    After which, you should have a drush file in your bin directory like on the screenshot:
  4. UPDATE: To install Drush system wide, simply move the entire Drush directory to /usr/local/lib, and place your symbolic link in /usr/local/bin (thanks cjdavis)

And that is it my friends. You can now go to the root of your drupal installation, and let your jaw drop by executing drush sql dump, and then drush update, and look at it update all the modules on your site in 1 minute, while you go grab a beer.

A command you will want to use is drush help to find out what commands you have available. Enjoy, and long live drush!

[EDIT]
From Ubuntu Lucid on, you can install drush from Synaptic, or the command shell like sudo apt-get install drush However, in Lucid you'll only get the 2.x branch. In Maverick you get the 3.x branch. Not sure how maintained these packages are, if you care to help or wonder how this is going, head over to https://launchpad.net/ubuntu/+source/drush

AttachmentSize
folder-permissions.png 76.52 KB
symbolic-link.png 83.25 KB

Comments

Install to /usr/local for system-wide availability

Posted by cjdavis on June 23, 2009 at 11:00pm

On my server, I am hosting many sites for clients, so each one is running in a separate user account - I need Drush to be available to all users on the system. Perhaps Aegir would help simplify even more, but that's another project..

To install Drush system wide, simply move the entire Drush directory to /usr/local/lib, and place your symbolic link in /usr/local/bin - that's it.

Thanks, updated

Posted by manuel garcia on July 2, 2009 at 6:41pm

I've updated the post to include that information -- thanks!

Thanks for this - for some

Posted by stephenplatz on August 5, 2010 at 11:11pm

Thanks for this - for some reason I'm getting the following when I use this installation method:

Unable to download drupal-6.17.tar.gz to /var/www/ from [error]
http://ftp.drupal.org/files/projects/drupal-6.17.tar.gz
An error occurred at function : drush_pm_download [error]

Everything seems to be in place, not sure what to try next. Has anyone else seen this?

Are you perhaps trying to

Posted by mcrittenden on August 6, 2010 at 1:11am

Are you perhaps trying to download it to a folder which you don't have permissions for? If so, maybe try "sudo drush whatever" instead of "drush whatever", or just try a "chown -R yourusername /var/www" to make yourself (not root) the owner of /var/www.

Yes, one of those dumb 'why

Posted by stephenplatz on August 6, 2010 at 3:00am

Yes, one of those dumb 'why didn't I do that first' moments - changing the owner of the /var/www directory worked, of course. I'm on a new install of Ubuntu, but I don't remember that issue with using Drush before. Thanks again!

so this would change the ln -s to . .

Posted by bewhy on April 7, 2011 at 6:18pm

so if i was going to do this, I'd change the symbolic link to read:

ln -s path/to/drush/drush /usr/local/bin

?

what you don't know will inspire you

destination path or filename

Posted by Silicon.Valet on April 7, 2011 at 6:42pm

ln -s path/to/drush/drush /usr/local/bin/ <- note the slash
ln -s path/to/drush/drush /usr/local/bin/drush

It is not working for me.

Posted by stanleychen on August 20, 2011 at 4:37am

I download the latest release 7.x-4.5 and follow the instruction in Ubuntu but not working, and idea?

In Ubuntu 9.10 I had to do this:

Posted by johnvsc on December 2, 2009 at 1:23am
  • Grab the Ubuntu Install disk :) and place it in the drive
  • Install the php5-cli libray (CLI means Command Line, btw) $ sudo apt-get install php5-cli
  • Follow the direction above but...
  • Use the following to create a symbolic link: $ sudo ln -s /home/johnvsc/drush/drush /usr/bin/drush or, in other words : sudo ln -s /home/username/drush/drush /usr/bin/drush

The bin was in a different place on my install :)

enjoy!

Update PHP Cli memory limit

Posted by MichaelP on December 19, 2009 at 4:46pm

When I ran "drush features", just for fun, I got:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 311296 bytes)

This requires upping the php memory limit for cli which in my case is in: /etc/php5/cli/php.ini

Set it to: memory_limit = 256M;

That sorted it!

Thanks for the post!

Don't forget to set this, as

Posted by liberatr on August 6, 2010 at 3:51pm

Don't forget to set this, as we were having a similar Drush Memory Limit issue on our production server. Until I knew that command-line had a separate memory limit, I was baffled. Thankfully, I have some smart friends.

Hi Manuel :) The actuality,

Posted by eloivaque on May 23, 2010 at 4:04pm

Hi Manuel :)

The actuality, drush is in repository of ubuntu, but is version 2.0 and drush make do not work.

Very true

Posted by manuel garcia on August 13, 2010 at 1:10pm

You could just do sudo aptitude install drush but you'd only get drush 2.0-6 (in lucid).

All the goodies are in Drush 3, so I stil would go with manualy installing, not that much to it =)

This gets me thinking... perhaps we should set up a PPA on launchpad with the the latest Drush... any takers?

[EDIT]

The 3.x branch is coming up on maverick, see https://launchpad.net/drush
I'm not very familiar with launchpad, but we should definetly setup a PPA for the latest stable Drush.

[EDIT2]
I have asked for this on there https://answers.launchpad.net/drush/+question/120987

There's a ppa repository that has drush 4.4 at https://launchpad.net/~brianmercer/+archive/drush
You can add it from the commandline using sudo add-apt-repository ppa:brianmercer/drush; sudo apt-get update; then install it from the commandline using sudo apt-get install drush

Edit: Whoops, just saw that you posted a link to this further down.

I've also updated the post

Posted by manuel garcia on August 13, 2010 at 1:17pm

I've also updated the post with the information, thanks!

Install drush on Ubuntu 10.10

Posted by newmember on January 4, 2011 at 3:52am

Go to this page and find the link to the release version you want:
http://drupal.org/node/97249/release

Then:
cd /usr/local/lib/
wget http://ftp.drupal.org/files/projects/drush-6.x-4.0-rc8.tar.gz <---- Change to the release you want
tar zxvf drush-6.x-4.0-rc8.tar.gz
cd drush/ <-----There is drush, just checking
cd /usr/local/bin
ln -s /usr/local/lib/drush/drush drush

Then:
Go to the root folder of your website
cd /root/folder/of/drupal/
drush

I dont know drush all that well but here are a few fun ones:
drush status <----- what version of drush are you running
drush dl drupal <------ will download current release of drupal

PPA

Posted by manuel garcia on January 14, 2011 at 4:10pm

I see that someone has setup a PPA for drush 4.x branch, mind you I haven't tried it, nor do I know the person behind it. Just thought I'd let you guys know about it:
https://launchpad.net/~brianmercer/+archive/drush

I've been applying the new

Posted by brianmercer on February 1, 2011 at 8:59pm

I've been applying the new source packages to the debian package and uploading to my ppa. Haven't had any problems myself.

Antoine's been updating his debian repo also. http://packages.debian.org/sid/drush

If anyone has any issues with my ppa, let me know.

Having error.

Posted by siva.thanush on February 3, 2011 at 11:40am

Hi i m getting error while i tried any of the drush commands.
"cannot redeclare drush_test_clean() (previously declaredin /etc/drush/commands/core/test.drush.inc:50) in /usr/share/drush ......"

Siva
Sify

Search the drush issue queue

Posted by manuel garcia on February 7, 2011 at 8:14pm

Search in the issue queue, see if anyone else has seen that problem. If you cant find anything, create a new issue there.

Try cleaning out old drush 3 files first

Posted by Jonathan Peterson on February 20, 2011 at 5:52pm

I had this same error when upgrading from Drush 3 to Drush 4. There were some old drush 3 files that were still sitting in my drush directory. To address this I just deleted my drush install and then re-installed Drush 4. All copacetic now.

Hope this helps.

It sure did, thank you.

Posted by jgrubb on June 2, 2011 at 9:07pm

It sure did, thank you.

John

Same problem

Posted by arsunyiu on June 16, 2011 at 5:09am

Hi all, I am using ubuntu 10.04.2.
I got the same problem, anyone know the solution??

remove the drush via sudo

Posted by philosurfer on July 12, 2011 at 12:37am

sudo apt-get purge drush

then install manually...

or if you have Ubuntu 11 you can reinstall from apt-get and it will pull version 4.4


 "we are the cult of personality."

Works for me! Many thanks.

Posted by nourcy on September 19, 2011 at 9:03am

Works for me! Many thanks.

Drush in ubuntu repository

Posted by kurkuma on June 27, 2011 at 3:52pm

The version 4.4 of drush is available as per sudo apt-get install drush.
Installed from Ubuntu 11.04 w/o probls.

Jorge

How I installed drush on ubuntu 10.04 server

Posted by pfiliatreault on February 8, 2012 at 8:18pm

1- If in a vm, take a snapshot

2- Upgrade your ubuntu server. login via ssh as admin.

$sudo apt-get update
$sudo apt-get upgrade

3- install PEAR.

$sudo apt-get install php-pear

4- tell PEAR to update its own channel.

$sudo pear channel-update pear.php.net

5- tell PEAR to upgrade itself to the newest version.

$sudo pear upgrade-all
You should now have the newest version of PEAR installed.

6- Install drush

$sudo pear channel-discover pear.drush.org
$sudo pear install drush/drush

7- install Console_Table

$sudo pear install Console_Table

8- Update your drupal core

$cd /var/data/drupal

$drush pm-update

That's it. Pretty easy. Thanks everybody for your help.

Ubuntu 10.04LTS

Posted by CZ on June 12, 2012 at 12:52pm

In Ubuntu 10.04LTS, Drupal 7.14 and Drush 5.4

Manual installation

  1. download drush (http://ftp.drupal.org/files/projects/drush-7.x-5.4.tar.gz)
  2. unpack and copy the directory "drush" to "/usr/share/"
  3. Make the 'drush' command executable:
    $ sudo chmod u+x /usr/share/drush/drush
  4. Make the director "/usr/share/drush/lib" readable.
  5. create a symbolic link:
    $ sudo ln -s /usr/share/drush/drush /usr/bin/drush
  6. Go to your website and test it
    $ cd /var/www/drupal7
    $ drush status
  7. disable the file /etc/php5/cli/conf.d/ldap.ini if required by ";" before "#".

AltStyle によって変換されたページ (->オリジナル) /