About a year ago, I wrote a post on how to get Ruby on Rails to work on Ubuntu 10.10. I’ve since updated it a bit. Today, after doing a clean install of Ubuntu 11.10, I tried to follow my own recipe to install Ruby on Rails, but as it turns out a few things have changed. No biggies, the recipe is still mostly valid, but I thought it might be a good idea to write a new post with updated instructions instead of just changing the old one.
Just as the last time, this is just what happened to work for me, I’m making no claims that this is the best, or even a good way to do it.
First of all, it’s a good idea to install some prerequisites, that will be needed anyway:
$ sudo apt-get install vim-gnome curl git git-core libxslt-dev libxml2-dev libsqlite3-dev
Technically, gvim (vim-gnome) is not a prerequisite, but it’s still nice to have! Some of these you might already have installed, in that case, congratulations.
$ bash -s stable < <(curl -s [https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer](https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer))
- Make some changes in .bashrc:
Add to the end:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Change the line that reads
[ -z "$PS1" ] && returnto
if [[ -n "$PS1" ]] ; then
Add before the row you added to the end (on it’s own row):
- Restart the terminal, or just run
$ source "$HOME/.rvm/scripts/rvm
- Check that rvm works, run
$ type rvm | head -1. You should get the result “RVM is a function”
- It might be a good idea to run
$ rvm notes, just to make sure everything is fine and you haven’t missed anything so far.
$ rvm package install zlib
$ rvm pkg install openssl
- Time to install Ruby 1.9.3!
$ rvm install 1.9.3 --with-openssl=$HOME/.rvm/usr
Note: The openssl stuff is not needed for rails to work, but if you want to use Heroku to publish your stuff, you’ll need it, so might as well install it right away!
$ rvm --default use 1.9.3
Ok, final step. Run
$ gem install rails to install Rails. This takes a little while, but when it’s done everything should work. You can check that everything works by creating a new rails application in a directory of your choice:
$ rails new test_app, or just jump to “The first application” chapter in the Rails Tutorial.
And yeah, some of these steps might not actually be necessary, or may break your computer. Also, these steps installs RVM, Ruby and Rails only for the current user, not system-wide.