Install the Ruby 1.9.1 (which is actually 1.9.3, presently) package:
aaron@naegleria:~$ sudo apt-get install ruby1.9.1-dev
You will also need to remove all packages that use Ruby 1.8.x. The easiest way to do this is to just use synaptic, search for “ruby”, sort by “installed” (the far left column), and “Mark for Removal” on each package that mentions ruby1.8. There should be about 3, possibly more.
Once that’s done, check in the terminal:
aaron@naegleria:~$ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] aaron@naegleria:~$
As long as you see “1.9.x” or better, you should be fine.
Now install Rails 3:
aaron@naegleria:~$ sudo gem install rails
This will take a while. You’ll see lots of stuff fly by. When you’re done, confirm:
aaron@naegleria:~$ rails -v Rails 3.2.8 aaron@naegleria:~$
That’s it! Note that future gems will need to be sudo installed, if you aren’t using Bundler. Running bundle
will prompt you for your sudo password.
Installing Ruby 1.9 and Rails 3 on a Hostgator/CentOS VPS
[…] I try to use the package management system wherever possible. In this case, though, CentOS is apparently behind the curve with its available […]
Ruby 2.x + Rails 4 in Ubuntu 14.04
[…] This a modernized update to a previous post I wrote on here, about doing Ruby 1.9 & Rails 3. […]