Before I move on to posting about installation instructions, some people might wonder why I am using Dreamhost.

Would I recommend Dreamhost for Rails hosting?

I wouldn't recommend it to people with budget and have little patience. You can go for Heroku, Slicehost and Linode. I've tried Linode and it's a very good option for advanced users, a.k.a, Unix nerds. Clients have used Slicehost and other VPS hosts. Point is, VPS rules. Dreamhost has it PS plans but if you are serious about business go for the so-called cloud services offered by Rackspace. (And just an F.Y.I, Rackspace also owns Slicehost).

*How long have I have been using Dreamhost *

Year 2005. It's been four years and I am happy enough to be able to deploy applications on shared hosting.

Dreamhost often complains that you don't have a proper gem environment path when you are installing ruby gems. Here's how to install your own version of ruby gems on Dreamhost.

Log into your shell account (change the user and domain to match your settings):

Copy your public key to the server:

   cd ~
  ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]

Create the necessary directories:

  cd ~
  mkdir .gems bin lib src

We need to setup a bunch of paths so that each time you log in everything is setup:

  echo 'export PATH="$HOME/bin:$HOME/.gems/bin:$PATH"' >> .bash_profile
  echo 'export RUBYLIB="$HOME/lib:$RUBYLIB"' >> .bash_profile
  echo 'export GEM_HOME="$HOME/.gems"' >> .bash_profile
  echo 'export GEM_PATH="/usr/lib/ruby/gems/1.8:$GEM_HOME"' >> .bash_profile
  echo 'alias gem="nice -n19 ~/bin/gem"' >> .bash_profile
  source ~/.bash_profile

Next we need to install the latest version of RubyGems and configure it properly:

  cd ~/src
  wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
  tar xzvf rubygems-1.3.*
  cd rubygems-1.3.*
  ruby setup.rb --prefix=$HOME
  cd ~/bin
  ln -s gem1.8 gem
  cd ~

Now we need to test that gem is installed:

  which gem   # should return /home/USERNAME/bin/gem
  gem -v      # should return 1.3.0

The gems may have been updated since this article was written so lets update RubyGems

  gem update --system

Install Rails

  gem install rails

  And these are just some gems I use for an application: 
  gem sources --add http://gems.github.com/
  gem install activemerchant
  gem install haml-edge
  gem install fastercsv
  gem install javan-whenever
  gem install scrapi
  gem install geocoder
  gem install chriseppstein-compass

Specifiy the gem environment on your application

  gem env

will return:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/USERNAME/.gems
  - RUBYGEMS PREFIX: /home/USERNAME
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /home/USERNAME/.gems/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/USERNAME/.gems
     - /usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com/"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com/

On your environment.rb file:

ENV['GEM_PATH'] = '/home/USERNAME/.gems:usr/lib/ruby/gems1.8/' 
comments powered byDisqus

Hello! I am Kat. I've been a developer for several years. When I'm not sitting down, reading and working for long hours, I am traveling to some place of interest.
If you want to reach out, you can send me an email or add me up on Google Plus.