After installing Ruby and Ruby Gems:
$ sudo apt-get install ruby rubygems
...
$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
$ gem -v
1.3.7
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/:
Under no circumstance should you install Ruby, Rubygems or any Ruby-related packages from apt-get. This system is out-dated and leads to major headaches. Avoid it for Ruby-related packages.
The Debian version of RubyGems installs Gems into /var/lib/gems/1.8/
and Gem binaries into /var/lib/gems/1.8/bin
. You need to make sure that directory is in your $PATH
.
This is a typical example of what I call the "If you hear hooves, think horses, not zebras" rule. If a computer tells you it cannot find something, the first thing to look for, is if that something is actually there, the second thing is whether the computer is looking in the right place. Installing libreadline5-dev
OTOH is pretty far down the end of the list …
In this case, you are telling the computer to execute the file rails
in the $PATH
, which simply doesn't exist, because the directory it was installed into is not in the $PATH
.