Install Git & Composer
The developers of Drush recommend installation through Composer, a PHP dependency manager. The Drush project is hosted on GitHub and controlled with Git, another necessary app to install.
sudo apt-get install git
curl -sS https://getcomposer.org/installer | php
Move the composer.phar file to /usr/local/bin/, so that it can be accessed from any directory:
sudo mv composer.phar /usr/local/bin/composer
Install Drush for All Users on the Server
Composer is designed to install PHP dependencies on a per-project basis, but the steps below will install a global Drush for all projects.
Create a symbolic link between Composer’s local bin directory, /usr/local/bin/composer, and the system’s bin directory, /usr/bin/:
sudo ln -s /usr/local/bin/composer /usr/bin/composer
Use Git to download - or clone - the GitHub Drush project into a new directory:
sudo git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
Change the working directory to the new Drush directory:
Use Git to checkout the version of Drush that you wish to use. The release page is at https://github.com/drush-ops/drush/releases. Below is a partial image of the release page with a red pointer displaying a sample version number.
For a different release, replace the version number in the following command:
sudo git checkout 7.0.0-alpha5
Create a symbolic link between the Drush directory in /usr/local/src to /usr/bin, so that the Drush command can be called from any directory:
sudo ln -s /usr/local/src/drush/drush /usr/bin/drush
Now, run the Composer install command:
sudo composer install
Drush has now been installed for all users on the server. Check for the proper version number: