Installing Drush onto your server

This article discusses how to install Drush on InMotion Hosting servers. You will need to have SSH access and root access on your account in order to install Drush. If you do not yet have root access, please see our article on obtaining root access for your account. The steps below assume you have the ability to connect to your server via SSH. If you do not have the ability to do so, you will need to enable SSH on your server and then add your IP to the firewall so it can connect.

How to install Drush

  1. Connect to your server via SSH.
  2. Once connected, confirm that PEAR is on the server. You can do this by typing the command “pear version” in your command line. You should have no issue with this as all our servers have PEAR on them by default. The command should produce results similar to the example below.
    $ pear version
    PEAR Version: 1.9.4
    PHP Version: 5.4.20
    Zend Engine Version: 2.4.0
  3. Once confirmed, simply type in the command “pear channel-discover pear.drush.org” on your console. This will initialize the channel and add it to your PEAR channel list.
    $ pear channel-discover pear.drush.org
    Adding Channel “pear.drush.org” succeeded
  4. After adding the channel, we now need to install Drush. This is done by typing “pear install drush/drush” in the command line. You should see the install succeed as the code below demonstrates.
    $ pear install drush/drush
    downloading drush-6.2.0.0.tgz …
    Starting to download drush-6.2.0.0.tgz (505,989 bytes)
    …………………………..done: 505,989 bytes
    install ok: channel://pear.drush.org/drush-6.2.0.0

Installing a specific version of Drush

The steps above will install the most current stable version of Drush onto your server. You may, however, need a specific version of Drush installed. For example, if you are using php version 5.2, you cannot use Drush version 6. You will need to install version 5.9. To do this, simply enter the install command as shown below.

$ pear install drush/drush-5.9.0

Uninstalling Drush

Should things go wrong, or you simply decide that you no longer wish to use Drush, you can uninstall it from your server with the “pear uninstall” command. Below is an example of how to uninstall drush.

$ pear uninstall drush/drush
uninstall ok: channel://pear.drush.org/drush-6.2.0.0

You now know how to install and even uninstall Drush from your server here at InMotion Hosting. Should you have any further questions, be sure to take a search through our Community Support Center. If you cannot find your topic there, be sure to ask the team a question and we will get back with you as soon as possible.

Thoughts on “Installing Drush onto your server

  • It is now close to the end of 2017. Drupal 8 will have been out for two years now. I have root access to my VPS. I was able to install Composer, but for whatever reason when I follow the procedure to install drush, it does not install on the server.

    I tried this with Composer at the beginning when first working with Drupal 8 but it would not install.

    I’m going to try again soon insofar as I plan to do development directly on my server. But if there is no path to do that, it will be a big problem.

  • Hi Christopherm,

    Could you please let me know, still at present time we can not use Drush on Drupal 8 site Or something has been done in that way. I am looking for Drupall 8 hosting and looking for Drush facility as Drush solves many issues for non-technical people. Thank in Advance.

    • Unfortunately, we do not currently have plans for implementing Drush and Composer our shared servers.

      Thank you,
      John-Paul

    • Hello, Kingsley. Thank you for your question about Drush 8 and Composer. At the moment we have no plans to make Composer available in shared hosting.

  • I followed the directions, but when I typed pear channel-direction pear.drush.org, I received this error message:

    Discovering channel pear.drush.org over http:// failed with message: channel-add     : temp_dir is not writable: “/root/tmp/pear” – You can change this location with                                                 “pear config-set temp_dir”

    Trying to discover channel pear.drush.org over https:// instead

    Discovery of channel “pear.drush.org” failed (channel-add: temp_dir is not writa                                                ble: “/root/tmp/pear” – You can change this location with “pear config-set temp_                                                dir”)

    Could you advise? I assume I’m on a shared hosting account that would allow this?

    • Hello Pat,

      Unfortunately shared servers do not allow root access, which is needed to install Drush in this manner.

      Kindest Regards,
      Scott M

  • It is not working now. Getting the below error

     

     Execution of ‘/bin/pear channel-discover pear.symfony-project.org’ returned 1: Discovering channel pear.symfony-project.org over http:// failed with message: channel-add: Cannot open “http://pear.symfony-project.org/channel.xml” (File http://pear.symfony-project.org:80/channel.xml not valid (received: HTTP/1.1 404 Not Found

     

    ))

    • Hello Sunil,

      Sorry for the problem that you’re having. Can you provide a little more information? Is it related to Drupal? The messages we’re seeing do not appear to be Drupal-specific. It’s possible that there may be permissions problems or that you need to make sure that the files exist. The last error indicates that a particular file is not found.

      I hope this helps to answer your question, please let us know if you require any further assistance.

      Regards,
      Arnel C.

  • Oh inmotion, how you tease with such great servers and software but no Drush on shared hosting??!!  Very close to perfect habitat for Drupal developers who have wandered the wilderness of web hosting, please reconsider Drush on shared!

    • Hello Phoenix,

      We are definitely moving in that direction. We are currently making many improvements to our shared hosting and Drush is on the list! Unfortunately I do not yet have a time frame, but it is coming.

      Kindest Regards,
      Scott M

  • Thank you, John-Paul!  That is clear to me now.  As VPS is not an option for me, I am looking forward to Drush being installed in shared severs before long…

  • How can one enable or install drush on a shared-hosting server?

    According to the cited arcitle in your post, to set the root password seems possible on a shared-hosting server (to my surprise!), but the actual instruction didn’t seem to be applicable: https://www.inmotionhosting.com/support/website/ssh/root-access-faq

    I suppose there are many users (or almost all the Drupal users) who want to use Drush and I am one of them, so I am guessing it is available somewhere…?  If not, may one just install it from the source code in their home area on a shared-server?

    • Hello Masa,

      Thank you for your drush question. While we are considering adding drush on shared servers, at this time it is not available.

      You will need a VPS, or Dedicated server to get root access, and install drush.

      If you have any additional questions, feel free to post them below.

      Thank you,
      John-Paul

Leave a Reply