For things like Ruby, I never wait and rely on the Linux distro to keep
up. I also like(need) to have multiple versions of Ruby available.
Ruby, like many different applications, you can download the source and
configure it to install to an alternate location. This allows you to try
out different versions, without touching the OS install. This works for
most things, I'll explain here for Ruby.
To keep this separate from the OS, pick a location. Common locations are
things like /opt, /cots, /prod or something. Or keep it in your home
directory. Lets stay with the home dir so you don't need root to do
anything. make a directory in your home dir called opt.
Grab the Ruby version you want. Lets say the latest release of Ruby
Untar that in your home directory some where. In the directory that is
created from the untar, run
That will run through configure, hopefully find all it needs.
Now just run "make" Hopefully everything builds.
Now run make install to install it to your area.
It should create
Now, put that version of ruby in your path before anything else. So when
you run "ruby" it grabs that version.
Now when you add gems, or build things like ruby-gnome2, specifically
call out that "ruby" or "gem" binaries(if its first in your path then
you don't need to give it the absolute path) (run "which ruby" to see
which one you are pointing at)
So if you grabbed the latest ruby-gnome2 release, you would untar that.
cd into that directory and run
cd <untarred ruby-gnome2 area>
Presto, you just build ruby-gnome2 into your own "sandbox build"
I usually script this, and keep the gems I need installed local. So I
can rebuild a clean ruby install, with all the gems I need. I used gem
fetch to get local copies of the gems I need. I can quickly build 4-5
different builds of ruby, and test them all out with my apps.
The script I have looks something like this(I'm typing this from the top
of my head so I might have a typo somewhere)
set instDir = /home/username/opt/ruby-1.9.2
tar xf rubyDistro.tar.bz2
$instDir/bin/gem install -l somegem
$instDir/bin/gem install -l somegem2
$instDir/bin/gem install -l somegem3
tar xf rubyGnome2Distro
The key is I had grabbed the tar files for the ruby distro, and the
ruby-gnome2 distro ahead of time. Including the gems I wanted. I have it
all local(I don't like to rely on gem to find the latest or whatever is
needed. I really like to be explicit so I know what gems are installed.)
So with the above script, I can have many different ruby installs. I
don't go grab a new gem or ruby-gnome2 or anything with out playing with
it in a sandbox build.
The main thing I use the OS for is just to use yum/apt to get the base
things I need outside of the Ruby build, like glibc-devel or other
stuff. I like to keep that as part of the OS.
SO I've rambled on enough, but it the main thing to keep in mind that
"configure --prefix=somedirecty" can be used for almost everything that
follows the "normal" gnu like build area.
I have gvim, gdb, gnuplot, and lots of other things installed into my
own "opt" area. I like to keep the separate too, not "everything all in
So instead of a generic /usr/local, which has bin/man/lib for everyone.
I like to go one level more, specifying the component I am building.
Following my convention above I have something like
Each of those dirs in turn has its bin, man, lib sub dirs. For each
thing I build, I just add that component in my PATH, MANPATH,
LD_LIBRARY_PATH before the OS ones.
it allows you to be nice and specific with different releases of things.
And easily back out of one that "did not go well" as you didn't pollute
your OS, or a shared /usr/local area.
Posted via http://www.ruby-forum.com/.