Next Generation Ubuntu Ruby Packages

We’ve been providing optimized Ruby 1.8 and Rubygems 1.3.7 packages for Ubuntu for years now but some technical issues prevented us from providing 1.9.3 packages alongside them. So we started out afresh from the very latest Debian 1.8.7 and 1.9.3 packages, and added:

So this gives you Ruby 1.8.7, Ruby 1.9.3 and Rubygems 1.8.21 on Ubuntu 10.04 Lucid through to the latest LTS Ubuntu 12.04 Precise. You can install both Ruby 1.8.7 and 1.9.3 alongside each other and switch between them effortlessly. We’ve also updated our Passenger packages to work with both versions of Ruby (and our NGINX Passenger packages too). All available via the same repository.

Installation

All the above packages are available right now in our Launchpad package repository. You can add the repository to your servers like this:

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update

and you can install or upgrade ruby like this:

sudo apt-get install ruby rubygems ruby-switch

If you’re upgrading, some packages have been replaced so you will see apt removing some packages (such as rubygems1.8, irb1.8 and others) – don’t panic :)

To install Ruby 1.9.3:

sudo apt-get install ruby1.9.3

And you can run the different versions of ruby like this:

$ ruby1.8 -v
ruby 1.8.7 (2012-02-08 MBARI 8/0x8770 on patchlevel 358) [i486-linux], MBARI 0x8770, Ruby Enterprise Edition 2012.02

$ ruby1.9.3 -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [i486-linux]

$ gem1.8 install bundler

$ gem1.9.3 install bundler

Switching the default Ruby version

You can also switch the default Ruby version back and forth between 1.8 and 1.9.3 using the ruby-switch tool:

$ ruby -v
ruby 1.8.7 (2012-02-08 MBARI 8/0x8770 on patchlevel 358) [i486-linux], MBARI 0x8770, Ruby Enterprise Edition 2012.02

$ ruby-switch --list
ruby1.8
ruby1.9.1

$ sudo ruby-switch --set ruby1.9.1
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.

$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [i486-linux]

(note that Ruby 1.9.3 shows as 1.9.1, due to a historical Debian thing about binary compatibility)

Gem binaries

The binaries installed by gems (such as bundler’s “bundle” command) might not automatically use the current default version of ruby (preferring the version that was default at the time it was installed). In that case, you can run it under a specific version like this:

$ ruby1.9.1 -S bundle -v
Bundler version 1.1.3

Rubygems Compatibility

Note that some older versions of Rails do not work with the latest versions of Rubygems - if you're using our Rubygems 1.3.7 packages and don't want to upgrade them, you can pin them like this:

cat <<EOF > /etc/apt/preferences.d/rubygems
Package: rubygems
Pin: version 1.3.*
Pin-Priority: 600
Package: rubygems1.8
Pin: version 1.3.*
Pin-Priority: 600
EOF

Passenger Support

Our passenger packages have been updated to support switching between 1.8.7 and 1.9.3. By default it supports 1.8.7, and to add 1.9.3 support just install the package:

$ sudo apt-get install passenger-common1.9.1

Then you can safely switch the default ruby to 1.9.3, or tell Passenger to use it directly.

Experimental repository

We have a separate experimental repository that holds test builds.

We recommend only using this experimental repository for testing purposes. Use the main repository for stable updates.

docs/ruby-ng.txt · Last modified: 2012/08/10 10:45 by ben
 


UK Cloud Server Hosting & Cloud Hosting Providers - Brightbox Cloud

Simple and flexible UK cloud hosting for teams that insist on 100% uptime. Everything you need to deliver fast and highly available apps that delight your customers.

Get started now risk-free with £20 free credit.

Trusted by developers, big brands and people like you

512MB @brightbox cloud instance snapshotted, loaded onto new 2gb instance and cloud ip remapped. All without anyone noticing. ;)

Latest blog posts

Building a scaleable filesystem with S3QL and Orbit

All our Cloud Servers come with resilient local permanent disks, stored on SSDs in a RAID configuration. For periodic backups, you can use our server snapsho...

Read blog post

NixOS on Brightbox Cloud

NixOS is a Linux distribution that is configured using a functional language in a declarative way. I’ve been using it here at Brightbox as my main developme...

Read blog post

Scheduled snapshots for Cloud SQL

We’ve just added a new scheduled snapshots feature to Cloud SQL, our hassle-free MySQL cloud database service. Cloud SQL has always supported manually takin...

Read blog post

More blog posts...

Get started with Brightbox Sign up takes just two minutes...