Quick install for ruby 1.9.1 and Rubygems 1.3.5 from source on Ubuntu.

Here’s a quick howto guide on installing Ruby 1.9.1, Rubygems 1.3.5 and dependencies on Ubuntu.

The apt-sources version of Ruby is not the latest version, as such it is better to compile everything from source.

First make sure your package sources are up to date and you have build essential and zlib1g-dev installed:

sudo apt-get update
sudo apt-get install build-essential zlib1g-dev

Now grab Ruby 1.9.1 latest stable from here. The latest version at the time of writing is p376.

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz

Untar and install it:

tar zxvf ruby-1.9.1-p376.tar.gz
cd ruby-1.9.1-p376
./configure
make
sudo make install

Now go and get the latest Rubygems. At the time of writing this was 1.3.5. Grab this from here.

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz

Untar and install it (if you downloaded the tgz)

tar zxvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb

And these should both now be installed.
Check that everything is running:

ruby --version; gem --version

Your output should show something like this:

ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
1.3.5

If you are looking to install Passenger you will also need libopenssl-ruby. To install this, go to the ruby source:

cd ruby-1.9.1-p376/ext/openssl
sudo ruby extconf.rb
make
sudo make install

5 Comments

RSS feed for comments on this post. TrackBack URL

  1. Simon Harris — March 4, 2010

    When I try this I get the following error:

    ./instruby.rb:194:in `initialize’: No such file or directory – /usr/local/bin/testrb (Errno::ENOENT)
    from ./instruby.rb:194:in `open’
    from ./instruby.rb:194:in `open_for_install’
    from ./instruby.rb:320:in `block (2 levels) in ‘
    from ./instruby.rb:302:in `each’
    from ./instruby.rb:302:in `block in ‘
    from ./instruby.rb:409:in `call’
    from ./instruby.rb:409:in `block (2 levels) in ‘
    from ./instruby.rb:406:in `each’
    from ./instruby.rb:406:in `block in ‘
    from ./instruby.rb:402:in `each’
    from ./instruby.rb:402:in `’
    make: *** [do-install-nodoc] Error 1

    Any clues? I’m an ubuntu newbie

  2. Simon Harris — March 4, 2010

    OK. Belay that. It seems there was junk in the directory. I removed the remains and it all worked nicely! Thanks.

  3. Josh Scholar — April 14, 2010

    I got that working with a couple changes (had to use aptitude to install build-essential and libssl-dev – apt-install isn’t smart enough).

    Anyway I have a question.

    Now that I can build ruby 1.9, lets say I want to play with developing ruby core stuff and I want to make versions that are broken etc for the sake of debugging, how do I tell it to make build a version of ruby in a different place or with a different name so that I can have a working version of ruby and a version I’m messing with.

    For that matter do you know what the recommended way to debug ruby core code is?

  4. Jason Green — April 14, 2010

    Hi josh,

    For multi-versioning of Ruby I would recommend using RVM: http://rvm.beginrescueend.com/

    There is a walkthrough on our site here: http://blog.dynamic50.com/index.php/2010/03/installing-ruby-on-rails-and-multiruby-on-snow-leopard/ for snow leopard but the instructions are pretty similar for Ubuntu.

    I hope this helps

  5. Jason Green — April 19, 2010

    Was just going through this again today and realised if you need to install the openssl libraries for passenger, you will need to make sure you have libssl-dev first which you can install by running: sudo apt-get install libssl-dev

Leave a comment

Preview: