Last updated 31 March 2017. Created on 14 August 2011.
Edited by eugenesia, rodtatham, isaac.el.cec, rudiedirkx. Log in to edit this page.

  • Install composer globally:
    $ curl -sS | php
    $ sudo mv composer.phar /usr/local/bin/composer
  • Install drush globally (for your user), you can specify the version:
    $ composer global require drush/drush:7.*
  • Add the composer path to your path (in your *.bashrc* or *.zshrc* or other):
    export PATH="$HOME/.config/composer/vendor/bin:$PATH"

While not recommended, Drush can easily be installed on Ubuntu by using Aptitude or apt-get. If you have sudo rights the quickest way to install Drush is from the Ubuntu repository:

$ sudo apt-get install drush

However, the version this currently will give you is 4.5 (using Ubuntu 12.04). Newer versions have many improvements so you should use Drush to upgrade itself to the latest stable:

$ sudo drush dl drush --destination='/usr/share'

Then you can check the update has been successful by executing:

$ drush --version

You could also install Drush manually by downloading it directly from the project page and following the instructions of the README.txt file.

For Ubuntu 10.04 LTS apt-get will provide 2.0 Drush version, you need to follow Ubuntu help support to enable backports and so have 4.4-1 version available, which can then by upgraded to 5.6 as described above.

$ sudo apt-get install -t lucid-backports drush

Looking for support? Visit the forums, or join #drupal-support in IRC.


aiwata55’s picture

As of Sep/15/2011, Ubuntu 10.04 downloads and installs Drush 2.x with this method.

nidash’s picture

sudo apt-get install drush
on 11.04 gave me drush 4.4. must add doing 'drush dl drush' upgraded my drush version to 4.5

Anonymous’s picture

cool .. if you want you can just click the edit tab on top of the page and completely rewrite it

seaji’s picture

drush dl drush -- not working

message in ssh terminal:
There is no *recommended* release for project drush on Drupal 6.x. [ok]
Ask the maintainer to review and
create/recommend a release in order to be compatible with drush and
the security broadcast system. A recommended development
snapshot release is sufficient. Alternatively, run pm-releases
command and explicity pm-download any non-recommended release that
might be available.

seaji’s picture

Not working
sudo apt-get install drush - not working

Linux server 2.6.35-22-server #35-Ubuntu SMP Sat Oct 16 22:02:33 UTC 2010 x86
_64 GNU/Linux
Ubuntu 10.10

drush status
parse_ini_file(/usr/share/drush/includes/../ failed to [warning]
open stream: No such file or directory
PHP configuration : /etc/php5/cli/php.ini
Drush version:
Drush configuration :

PS "Installing Drush on Shared Hosting Accounts" not working as well (
not found "drush" command

~/drush/drush status
unknow command "status"

Bad Bad

diqidoq’s picture

as you wrote: you use Ubuntu 10.10

... and what does the docs say in one of the first lines? ;-)

bfr’s picture

Works fine on 10.04.

TipiT’s picture

If you run sudo apt-get install drush drush is installed /usr/share/drush as default. So /usr/share/drush/drush has to executable in your $PATH environment variables (I think it is but check is by running in shell export).

Update from 4.4 (available from Ubuntu repo)

After sudo apt-get install drush
1. Run sudo drush dl drush.
2. Run sudo drush.
3. drush --version

Update further

Drush might let you know that "A newer version of drush, 7.x-5.0-rc4, is available..." is available. Running
1. sudo drush self-update
2. sudo drush
3. drush --version

Should work.

Energyblazar’s picture

The above given steps work perfectly......but just one more simple thing, do restart your pc, and then type drush --version

zarexogre’s picture

Hi, I can do the above but I want to instal the dev version of drush and cant find any docs anywhere. Can anyone help advise. This is because drush 5.1 now has drush_make in core and it doesnt work right: see bug

darthanubis’s picture

You are running the provision script as the root user. Exiting


kpastore’s picture

Steps 1 and 2 worked for my Ubuntu 12.04 installation. Upgraded to version 7.x-5.8. Thanks!

nateB’s picture

But this one did:

Long and short:

  • Download Drush from the project page.
  • Upload and extract the Drush archive to /usr/local/lib/ (or wget it from there, I reckon)
  • Make drush executable: sudo chmod +x /usr/local/lib/drush/drush
  • Add a symlink in the /usr/bin/ directory: sudo ln -s /usr/local/lib/drush/drush drush
  • Navigate (to one) of your site(s) folder, cd /srv/www/
  • Check status of Drush with drush status
  • Check the version of Drush with drush --version. For me, it's 5.8.
markbannister’s picture

In order to not have to run as root or sudo rights see

In user's home directory who will run drush and ahs web privileges change permissions of .drush and drush-backups (created during install) for that user
sudo chown -R username:usergroup ~/.drush
sudo chown -R username:usergroup ~/drush-backups

grzesag’s picture

if you are running Ubuntu 13.04 you can install drush using apt-get but it installes drush version 5.8.

To upgrade to version drush 5.9 please do following:
sudo drush dl drush --destination='/usr/share/php'

Hope it helps someone

remerjohnson’s picture

I installed via apt-get method on Ubuntu 13.10. Install worked fine, but when executing drush version, I get:

PHP Fatal error:  Call to undefined function json_encode() in /usr/share/php/drush/includes/ on line 708
Drush command terminated abnormally due to an unrecoverable error.                                [error]
Error: Call to undefined function json_encode() in /usr/share/php/drush/includes/, line

I went to that json_encode() function and found the following:

 * Converts a PHP variable into its Javascript equivalent.
 * We provide a copy of D7's drupal_json_encode since this function is
 * unavailable on earlier versions of Drupal.
 * @see drupal_json_decode()
 * @ingroup php_wrappers
function drush_json_encode($var) {
  // json_encode() does not escape <, > and &, so we do it with str_replace().
  return str_replace(array('<', '>', '&'), array('\u003c', '\u003e', '\u0026'), json_encode($var));

Any thoughts on what to edit?

couloir007’s picture

I'm having the same problem.

alfonsojosegarcia’s picture

I too, any solution? Help!!

amitsedaiz’s picture

Installing the package separately will do the trick.
For Ubuntu: sudo apt-get install php5-json

andykisaragi’s picture

Anyone like me currently getting this error when trying to install with PEAR:

Array to string conversion in /usr/share/php/PEAR/REST/13.php on line 80

This is due to a bug in drush:

pavithra.raman’s picture

I had issues in installing drush via PEAR, but it looks like the pear channel is not maintained or has a bug.
More in the discussion on the github repo for drush

Copying the instructions to install drush via github below

Install composer and drush (debian but should be the same for most linux's)

Note: directories are up to you This was mine ...

clone git somewhere
git clone /usr/local/drush

create a link to drush from the bin dir
ln -s /usr/local/drush /usr/local/bin/drush

install composer
curl -sS | php

move it into the path and rename it
mv composer.phar /usr/local/bin/composer
(or you can link it like with drush above)

get dependencies
cd /usr/local/drush
composer install

You should be ready to go
Please add to this instruction with anything required for your own OS

pavithra.raman’s picture

They have updated the PEAR channel. It should work now.

leolando.tan’s picture

I'm using Ubuntu 12.04. I have installed php-pear already but when i issue

pear channel-discover

I get this error:
could not create lock file: fopen(/usr/share/php/.lock): failed to open stream: Permission denied

How can I fix this?


leolando.tan’s picture

I just issued the commands with "sudo".

ernestto’s picture

I try to use pear channel-discover but not work I install drush with apt-get commands

rmfranciacastillo’s picture

Thank you! This has been very helpful! Just using:

sudo apt-get install drush

I was able to install drush in Ubuntu 14.04.

mralexho’s picture

Run the following command -

drush pm-download --select --all drush

Choose one of the available releases for drush:
 [0]   :  Cancel                                                
 [1]   :  7.x-5.x-dev            -  2013-Sep-30  -  Development 
 [2]   :  7.x-5.9                -  2013-Apr-17  -              
 [3]   :  7.x-5.8                -  2012-Nov-12  -              
 [4]   :  7.x-5.7                -  2012-Aug-18  -              
 [5]   :  7.x-5.6                -  2012-Aug-10  -              

Then select the release you'd like to download.

suresh kumara’s picture

I have installed drush several times but in ubuntu 14.04. I am getting error as below

/var/www/drupalenglish$ drush status
Drush needs to download a library from [error] in order
to function, and the attempt to download this file automatically
failed because you do not have permission to write to the library
directory /usr/local/lib/php/drush/lib. To continue you will need to
manually download the package from, extract
it, and copy the directory into your /usr/local/lib/php/drush/lib

johnhanley’s picture

Did you use sudo when installing drush?

abhai_zyxware’s picture

Follow the instructions here. Its quite simple to install the latest drush.

Sivaprasad C’s picture

Thanks abhai_zyxware, nice Article. That worked for me!

kiwimind’s picture

When following the instructions above, please ensure that when adding the directory to your path that it's different than stated:

export PATH="$HOME/.config/composer/vendor/bin:$PATH"

raphaelbluteau’s picture

Thanks kiwimind, that worked for me!

montag64’s picture

I already had drush installed (probably via pear and a digitalocean article circa 2015) and tried to update from 8.0.2 to 8.1.15. Anyway I installed the via composer globally without error and kept trying to run it but was getting 8.0.2 when typing drush --version. It was running drush from /usr/local/bin. Once I removed old drush manually and ran this...

export PATH="$HOME/.composer/vendor/bin:$PATH" started launching the new version.

Using Ubuntu 14.04 LTS with composer 1.5.2 and drush 8.0 to 8.1.15.

It seems like literally every two months there's a new package manager or dependency manager in linux. Why is this necessary? NPM? Brew? Pear? Composer? chocolatey? when will it end? We have reached a point of terminal silliness.

hiramanpatil’s picture

I had Drush 8 installed on the server. Received some errors while updating my Drupal site from version 8.3.3 to 8.4.0. so I have updated Drush to 9.0.0-beta8. Now drush commands are not working on the server. Everytime I execute Drush command it shows error messages like -

The pm-updatecode command was deprecated. Please see `composer outdated` and `composer update`.
For security release notification, see `drush pm:security`.

How can I downgrade Drush to previous version 8? Trying to unstalled Drush and install it again but PEAR or apt-get is not working. Not sure how Drush was installed on the server.

Current Drush version:-
Drush Commandline Tool version 9.0.0-beta8.

Help is appreciated.


adominique’s picture

I still can't upgrade above v 8.1.8.
Followed exact same procedure.
Almost same configuration Composer v 1.5.2, Ubuntu 14.04.2. and PHP 5.5.9 (is PHP version the problem?)

Stuck to Drush 8.1.8 on a Drupal 8.4.
This whole process is very annoying and I can't find a single and clear (and good) update explanation given by Drush or Drupal.

adominique’s picture

Finally made it manually like this (if it can help anybody):

download drush.phar v 8.1.15 from;
copied to /Home;
removed current 'drush' from /usr/local/bin;
make downloaded 'drush.phar' executable: chmod +x drush.phar
moved drush.phar to /usr/local/bin: sudo mv drush.phar /usr/local/bin/drush