Ruby on Rails Programming Tips

How to Install RubyGems and Rails on a Shared Web Host

by Chubs

webweb.jpg

RubyGems or Gem allows you to install extra packages and libraries for Ruby. You need Gem before installing Rails. You can get the latest version of RubyGems here.

cd /temp
wget http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgz
tar -zxvf rubygems-0.8.10.tgz
cd rubygems-0.8.10

To install RubyGems, you need to use Ruby to call the setup script:

ruby setup.rb

Here, you should see “Successfully built RubyGem” if it’s finished. Next, open the file “/usr/local/ruby/bin/gem” in your favorite text editor (such as vi) and edit the first line so you’ll know where to find your custom Ruby installation. Example:

#!/usr/local/bin/ruby

Now, add a few more symlinks:

cd /usr/local/bin
ln -s /usr/local/ruby/bin/erb erb
ln -s /usr/local/ruby/bin/eruby eruby
ln -s /usr/local/ruby/bin/gem gem
ln -s /usr/local/ruby/bin/gem_server gem_server
ln -s /usr/local/ruby/bin/testrb testrb
ln -s /usr/local/ruby/bin/update_rubygems update_rubygems

RubyGems is now installed. To install Rails, use:

gem install rails –remote