How to install Drush manually

This article describes how to install Drush manually.

Most hosting accounts already include Drush by default. However, it may be a few versions behind the newest version. To run the latest version of Drush, install it manually using the following procedure.

Installing Drush

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, follow these steps:

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

      composer global require drush/drush:9.x
  3. To determine the correct composer path for your account, type the following command:

    composer config --global home
    

    The composer path is one of the following:

    • /home/username/.composer
    • /home/username/.config/composer

    You will need this information for the next step.

  4. To add Drush to your path, type the following command. Replace composer_path with the path you obtained in step 3:

    echo 'export PATH="composer_path/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
    • To update Drush to the newest version, type the following command:

      composer global update drush/drush

More Information

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

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

 

 

Loading