Installing Ruby on Ubuntu 10.10 with RVM

Post to Twitter

RVM has quickly become one of the main ways to install Ruby. Even though the RVM documentation is very solid I’m going to walk through installing RVM and Ruby on a clean install of Ubuntu 10.10 (Desktop). Obviously if you are not using Ubuntu 10.10 you might need to change some of these steps.


I am running Ubuntu 10.10 on VMWare Workstation (the free VMWare Player will work as well).

On my default/clean Ubuntu 10.10 (Desktop) Curl and Git are not installed by default. So with a new Terminal session issue the following command:

$ sudo apt-get install curl git-core

The next command you won’t need to use sudo:

$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Now you need to update the .bashrc file. Assuming your in your home directory issue this command:

$ sudo pico .bashrc

Paste this to the very end of that file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

In the same file look for this line:

[ -z "$PS1" ] && return

Replace it with this line:

if [[ -n "$PS1" ]] ; then

Now, right before the first line you added at the end of this file, add this:

fi

The end of your file should look like this:

fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Save the file and exit Pico and exit your terminal session (or reload your session). Open a new terminal session (if you didn’t reload) and issue this command to verify RVM:

$ type rvm | head -n1

The response should be:

rvm is a function

Since I’m installing the MRI (Matz’s Ruby) version of Ruby I also need to install the following packages:

$ sudo apt-get install build-essential bison openssl libreadline5 libreadline-dev zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev

Note: Keep in mind your not limited to just a particular Ruby, there are many flavors you can install using RVM (JRuby, REE, etc.). See this for more info on your options available. Remember you might need to install other dependencies though so make sure to run this command to verify those dependencies:

$ rvm notes

Finally you can now install Ruby.

For Ruby 1.8.7 use this command:

$ rvm install 1.8.7

For Ruby 1.9.2 use this command:

$ rvm install 1.9.2

Set your new Ruby installation as the default Ruby:

$ rvm --default 1.8.7

Or:

$ rvm --default 1.9.2

Verify Ruby is installed and it is the correct version:

$ ruby -v
$ gem -v

Install any gems you need but make sure to read this first.

Post to Twitter

This entry was posted in Open Source, Ruby, Ubuntu. Bookmark the permalink.

10 Responses to Installing Ruby on Ubuntu 10.10 with RVM

  1. Pete says:

    Hey,

    Followed your instructions. Unfortunately not working on ubuntu 10.10 for me. I get “The program ‘ruby’ is currently not installed. You can install it by typing:
    apt-get install ruby” when trying ruby -v. When putting in type rvm | head -n1 I get “rvm is hashed (/usr/local/bin/rvm)”. Any ideas?

  2. Chad Lung says:

    Did you update your profile? If so then maybe the default Ruby didn’t get set?

    http://rvm.beginrescueend.com/rubies/default/

    Chad

  3. Pingback: Day 1 [Recovering Linux basics; On To The Ruby] « Ruby Newbie

  4. Anonymous says:

    Great informative post – simple and no fluff..

    Two thumbs up

  5. Robert Cigan says:

    Worked for me after I did restart, then I could install and see rubies

  6. Pingback: Neo4j.rb 1.0.0 and Rails 3 | Jayway Team Blog - Sharing Experience

  7. Rodo says:

    Excellent post. Thank you.
    But I can’t get console colors working again.
    I created the file named rvmrc. and set the flag as folows


    rodo@nb-rodo:~$ cat .rvmrc.
    set 'export rvm_pretty_print_flag=1'

    I’m missing something ?

    Thank you very much !
    Rodo

  8. Rodo, you have made little bit of mistake in naming of the file: there’s extra dot in the end of file name that should be taken away so that it would be called just .rvmrc

  9. Tay Joc Cing says:

    Thanks!

    I still did not get the ‘rvm is a function’ thing. But..I still managed to get 1.9.2 as the ruby version.

    With all the advice given everywhere else, my set up must have screwed up, so ReadLine was not required into irb. But after I did ‘rvm remove 1.9.2′ and then ‘rvm install 1.9.2′, it worked :)

Comments are closed.