Installing Drush on HostGator Baby Account (shared LAMP hosting)

Drupal logo

A big thanks goes out to WebbyKat, and especially to Christopher Shumate's detailed, flawless instructions. I was able to get Drush installed for use with my Drupal7 (D7) site on a shared hosting account. My web host is HostGator, and my plan with them is their Baby plan.... very affordable, and yet with meets all the requirements (including a high PHP Memory setting!) that Drupal 7 needs to be a fully operational Death Star. For posterity's sake, Christopher's wonderful instructions are duplicated here. All his hard work. I'm just spreading the knowledge around.

Here is how to install Drush on HostGator from start to finish:

  1. Enable SSH on your HostGator account
    • Visit http://gbclient.hostgator.com
    • Log in and click on "View Hosting Packages" in the left sidebar towards the bottom
    • You will see a bold link that says Enable Shell Access - click on this link to enable Shell access.

     

  2. Download an SSH client and connect to your server
    • Many people like PuTTY which can be downloaded here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
    • I enjoy using Bitvise Tunnelier which can be downloaded here: Bitvise Tunnelier download
    • Use the FTP credentials from your primary domain (since the primary domain FTP user is the only user with Shell access) to log in to HostGator's shell.
      • Host = Your Primary domain
      • Username = Your FTP/Shell username
      • Password = Your FTP/Shell password
      • Port: this should be set to 2222 not 22
  3. Download and Unzip Drush into your root directory
    • When you first log in to your shell you are in the root directory - ie: one level up from public_html
    • Type: wget http://ftp.drupal.org/files/projects/drush-7.x-4.5.zip to download Drush
    • Type: unzip drush-7.x-4.5.zip to unzip Drush
    • Type: rm -f drush-7.x-4.5.zip to remove Drush zip file

     

  4. Configure your .bash_profile file so the server can use Drush
    • While still in your root directory type: pico .bash_profile (This file is what will tell your server how to use Drush)
    • Scroll to the last line of text in this file and below the last line type:
      alias drush =' /home/[YOUR USERNAME]/drush/drush' - [YOUR USERNAME] should be the actual username of your HostGator account
      • If you are not sure what your username is type: "pwd" from your root directory and you will see "/home/[YOUR USERNAME]"
    • After you type this line hold down CTRL + X — Type "Y" to save changes — hit the Enter key to save and overwrite old .bash_profile file.
    • Type "exit" and hit return to close your prompt window. Logout of your shell session. Log back in and type: drush. If you see a list of commands pop up you have done it right and you are done!