Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Installing Drush on a MediaTemple (gs) Grid-Service Account

Parent Feed: 

[box type=”note”]Unless you are using MediaTemple, you should try the directions to install Drush using Pear on a shared host first, as that method is preferred.[/box]

A while back I wrote a quick guide for getting Drush up and running on a shared Dreamhost account and it was great to see lots of folks taking advantage of the power of Drush on a more commodity (read: cheap) host. But what if you’re running on a slightly more expensive and more featured host like MediaTemple’s grid offering? Well; you can run Drush there too, and I’ll show you how.

First off, we’re going the more manual route this time since I’ve had more success with it on MT. So head on over to the Drupal.org Drush project page and copy the latest tar.gz version of Drush to your clipboard. Then, log into your MT (gs) instance (or just run the command `cd` if you already have an SSH session open to your (gs) already) and create a directory called bin in your home directory and enter it:

mkdir ~/bin
cd ~/bin/

Next, download and extract the tarball of Drush you copied earlier:

wget http://ftp.drupal.org/files/projects/drush-All-versions-5.x-dev.tar.gz
tar xvpfz drush-*.tar.gz

Now, make a new folder in your home directory called .drush and enter it:

mkdir ~/.drush
cd ~/.drush/

Because of the more tightened security on the default CLI version of PHP MediaTemple provides we’re going to need to override some configuration values to suit us. In the ~/.drush/ directory make a file named drush.ini and place in it the following values (I prefer to use nano drush.ini for this):

memory_limit = 128M
error_reporting = E_ALL | E_NOTICE | E_STRICT
display_errors = stderr
safe_mode =
open_basedir =
disable_functions =
disable_classes =

Lastly, we need to add Drush into our path and reload the BASH configuration:

echo "export PATH=\"~/bin/drush\:$PATH\"" >> ~/.bash_profile
source ~/.bash_profile

That’s it! You now have a fully working Drush on MediaTemple; get out there and `drush up`. Go on, I know you want to :)

tl;dr: Install the latest 5.x-dev Drush on your (gs) by running this long command, or replace the highlighted tar.gz with the version you want:
mkdir ~/bin;cd ~/bin/;wget http://ftp.drupal.org/files/projects/drush-All-versions-5.x-dev.tar.gz;tar xvpfz drush-*.tar.gz;mkdir ~/.drush;cd ~/.drush/;echo -e "memory_limit = 128M\nerror_reporting = E_ALL | E_NOTICE | E_STRICT\ndisplay_errors = stderr\nsafe_mode =\nopen_basedir =\ndisable_functions =\ndisable_classes =" >> drush.ini;echo "export PATH=\"~/bin/drush\:$PATH"" >> ~/.bash_profile;source ~/.bash_profile

Updated 2/14/2013: Dreamhost made some config changes that required a different PATH variable for this method to work. The instructions above have been updated to reflect this. Editing drush.ini is now suggested to be done with nano, since some folks were having issues with the quad-chevron approach.

[box type=”note”]

Robin Monks has a passion for openness and freedom in technology and he’s spent the last 8 years of his life developing, supporting and maintaining open source software. He’s part of the panel of Drupal community experts who authored The Definitive Guide to Drupal 7 and currently provides independent consulting services. Reach him at 1-855-PODHURL.[/box]

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web