Submitted by Jordan on
So, I recently discovered Drush. I may be late to the game, but this is the coolest thing since CCK and Views.
In plain English: remember how computers used to be nothing but a black screen and white text? (Or green text, or orange, depending on how old you are.) Well, that's called the Command Line Interface and propeller-heads like myself still use it. Why? Because it's powerful. I mostly use it for installing and upgrading software.
"But web design happens on web pages. How would the CLI help with that?" Well, remember that web pages exist on web servers. And those servers all have command line interfaces. What does this mean? This means things that used to take half an hour - and dozens of mouse clicks - can now be done with a single command. My productivity is already soaring.
The downside: it was difficult to set up, and required some futzing. I found a couple excellent guides that got me most of the way there, but had to piece together the final bits myself. If you're reading this, you may have had the same problem, so here it is, my guide on
How to Install Drush on Hostgator
1. Ask Hostgator for SSH access. You have to file a support ticket request, but it's a simple matter of them flipping a switch for you. They did mine in under 24 hours.
2. Install Drush. The easiest way is to download the latest package from Drupal.org, unzip it, and upload it to your Drupal directory using ftp. You can also ssh in and use wget and unzip it directly on the server (see Step #4 below). Note: It says the only version available is for 7.x. It works with Drupal 6 too. Just go with it.
3. Configure Drush. Using ftp or ssh, go back to your root directory (/home/username, a.k.a. ~) and edit the file .bash-profile . It's a hidden file so your ftp client may not see it right away, but it's there. Using ssh it looks like this:
cd ~; pico .bashrc
Add the following code to the end:
alias drush='php /home/[user]/public_html/drush/drush.php' alias php='/usr/bin/php-cli' # Fix to allow Drush aliases to work PATH=$PATH:$HOME/bin:/home/calwease/drush export PATH
4. SSH to your server (if you haven't already). If you're using Windows, I recommend Putty. On Mac OS or Linux, all you have to do is:
ssh -p 2222 user@yourwebsite.com
Once you've logged on to your server, do the following:
cd public_html drush update
If it works, Drush will check your current Drupal installation to see if any modules need updating, and ask you if you want to proceed. If you say "yes," Drush will download all the updates for you, install them, and run update.php for you. Cool, huh?
Note: I've found it only works if you're in your Drupal directory. Theoretically you're supposed to be able to run Drush from anywhere on your server, but that never worked for me.
Yes, it does take some work to set up, but it was worth it the first time I logged on and did a year's worth of updates in 60 seconds. D7 makes it a little easier to manage installation and upgrades, but still can't touch Drush for convenience and power. Wowza.
Troubleshooting
I recommend the following resources:
- http://www.themerforhire.com/installing-drush-hostgator-shared-hosting
- https://www.drupal.org/node/1349732
- https://www.drupal.org/node/1002698
- http://drupal.org/project/issues/drush
Hat tip to Holly for getting me most of the way there.