Knowledge Base

How to install Drush manually

This article describes how to install Drush manually. Although shared and reseller hosting accounts include Drush by default, it is an older version that may not work with the most recent Drupal versions. For example, Drupal 8 requires Drush 8.

The information in this article only applies to hosting accounts that use CageFS. To determine if CageFS is enabled for your account, please see this article.

Installing Drush on an account that has CageFS enabled

The Drush installation process uses composer, a PHP dependency manager. Therefore, if you have not already installed composer on your account, you must do so before installing Drush.

For information about how to install composer on your account, please see this article.

To install Drush on an account that has CageFS enabled, follow these steps:

  1. Log in to your account using SSH.
  2. Select the Drush version you want to install:
    • To install Drush 8, type the following command:
      composer global require drush/drush:8.x
      
    • To install Drush 7, type the following command:

      composer global require drush/drush:7.x
    •  

  3. Determine the CentOS version on your server. To do this, type the following command:

    uname -r
    • If the output from this command contains el7 (for example, 3.10.0-714.10.2.lve1.5.9.el7.x86_64), then your server is running CentOS 7.
    • If the output from this command contains el6 (for example, 2.6.32-673.26.1.lve1.4.27.el6.x86_64), then your server is running CentOS 6.
  4. To add Drush to your path, type one of the following commands based on the CentOS version you obtained in step 3:

    • If your server is running CentOS 7, type the following command:
      echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >> ~/.bashrc
    • If your server is running CentOS 6, type the following command:

      echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
  5. To make the new path take effect immediately, type the following command:

    source ~/.bashrc
    

    Drush is now installed and ready to use on your account.

    • To confirm Drush installed correctly, type the following command:
      drush version

      Drush should display the most recent version number (at the time this article is written, version 8.1-dev is the latest version).

    • To update Drush to the newest version, type the following command:

      composer global update

More Information

For more information about Drush, please visit http://drush.org.