Drush is powerful command line interface to Drupal. It comes with a set of pre-built commands to manage Drupal installations from command line shell. Especially, you will find it very useful while performing tasks that do frequently like clearing cache, running cron, setting and getting of system variables etc. It is a must have tool for Drupal developers. Drush is also highly extensible. You can develop commands specific to your project or system wide.
This article will show how to install Drush for system wide usage, allowing all users of in system to run Drush commands. Because of the same advantage, you would need root access to complete the steps below. It is assumed that stand Unix-like OS is being used.
Drush depend on numerous packages on Composer. So Composer is required to install. Check if you have Composer already install by typing
composer -V in your shell. Otherwise, install composer globally using following commands below:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Now you can move with manual installation of Drush. First, change to directory
Clone Drush's git repository and change to Drush root directory.
sudo git clone https://github.com/drush-ops/drush.git
Make drush script executable for all.
sudo chmod +x drush
Create a symlink for the drush script to make it available in PATH always.
sudo ln -s /usr/local/drush/drush /usr/local/bin/drush
Now install Composer dependencies for Drush.
sudo composer install
Drush is ready to use! Just logout and login back. You can use
drush command anywhere in the system.