views:

8387

answers:

7

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?

So I think I need some way to tell Ubuntu that Ruby is in fact already installed?

+3  A: 

I got the Ruby specific info from this site. You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.

For installing in /opt:

$ ./configure –prefix=/opt/ruby
$ make install

If you want to use the /opt installed ruby, edit you ~/.bashrc and add

export PATH=/opt/ruby/bin/:$PATH

If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command

function setupruby {
     export PATH=/opt/ruby/bin/:$PATH
}
Dykam
Thanks, very helpful - at least that way I can avoid the conflicts.
Björn
A: 

Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.

You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

Nikhil Chelliah
My impression was that in the repositories there is only Ruby 1.9.0, which seems to be incomptible with Ruby 1.9.1. However, 1.9.1 is supposed to be the final release, 1.9.0 is just development version from whenever.
Björn
You're right. Looks like you'll have to build it yourself for now.
Nikhil Chelliah
+5  A: 

The way I did it was to build it using checkinstall which lets you build a deb package. So I downloaded the Ruby 1.9.1 source, did a "configure" and then "make", did a "checkinstall" and made the package name ruby1.9 so it installs as if it were a new version of ruby 1.9 (as it should).

+15  A: 

Save yourself the headache and use RVM (Ruby Version Manager)

Keep in mind, Rails 3 works best with Ruby 1.9.2. Ruby 1.9.2 fixes up quite a few bugs in 1.9.1 and is preferable to running 1.9.1.

With RVM installing 1.9.2 is a breeze.

Sam Saffron
+1000 I finally got around to trying this on OSX today, and it's brilliant. This page was particularly helpful: http://www.rubyinside.com/rvm-ruby-version-manager-2347.html
Yar
My world has been ROCKED! I should have checked into this sooner. =] RVM is awesome!
Andrew
+8  A: 
sudo apt-get install ruby1.9.1-full

(http://www.ruby-lang.org/en/downloads/)

IanVaughan
+2  A: 

Here is a short and convenient way to install 1.9.1 and to make it default: http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala

Michael Lazarev
A: 

I created a launchpad ppa for ruby 1.9.2. Details in the links below

http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/

sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
freethinker
I have added the ruby 1.9.2 final build to my ppa
freethinker
Read more about it here http://www.humbug.in/2010/ruby-1-9-2-final-build-for-ubuntu-lucid-uploaded-to-launchpad-ppa/
freethinker