Installing Rails on Debian or Ubuntu is quite simple. To ensure that you have a Rails-compatible version of Ruby installed, do not install the old (and possibly broken) version of Ruby with apt-get/aptitude. Rather, install Rubygems and have it fetch Ruby for you.
From the command line, run:
aptitude update && aptitude upgradeThen, run
aptitude install rubygems build-essential
This will install RubyGems, the ruby package manager, and pull in ruby if you don’t have it installed already. The build-essential package contains all the native build tools for your system (gcc, dev libs, etc.). Build-essential isn’t required for Rails itself, but assuming you’ll ever want to install a gem with native extensions (like mongrel), you’ll need it.
Don’t forget to export the path via /etc/bash.bashrc (eg:
export PATH=$PATH:/var/lib/gems/1.8/bin)
Lastly, we’ll install rails itself:
gem install rails --include-dependencies
You’re done.
Note:
Do not install rails using apt-get/aptitude! The debian repository includes a very old and broken version.