Ruby
Ruby1.9.1 brings exciting enhancements, not to mention speed enhancements thanks to Yarv, and 1.9.1 is considered stable, so it's a pity if you don't start playing with it. Rails 2.3 should be compatible enough, along with Rails 3 beta.First install both Ruby versions ....
sudo aptitude install ruby-full rubygems ruby1.9.1-full rubygems1.9.1Then issue these commands ...
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.8 500 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.8.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.8 \
--slave /usr/bin/irb irb /usr/bin/irb1.8 \
--slave /usr/bin/gem gem /usr/bin/gem1.8 \ --slave /var/lib/gems/bin gem-bin /var/lib/gems/1.8/bin
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \
--slave /usr/bin/gem gem /usr/bin/gem1.9.1 \ --slave /var/lib/gems/bin gem-bin /var/lib/gems/1.9.1/binThen to switch to Ruby1.9 (or back to Ruby1.8) ...
sudo update-alternatives --config rubyA dialog is presented in which you select the version you want. It has the advantage that not only is the main interpreter "ruby" referencing the 1.9 version, but also the utilities "ri", "irb" and "gem" plus the ruby man-pages.
The rubygems bin path will be available in /var/lib/gems/bin which will point to the right gems directory. So add that in your PATH (in ~/.bash_rc or in ~/.profile). Myself I've installed Rails 3beta on Ruby 1.9 and Rails 2.3 on Ruby 1.8 ... and when switching between versions, the right "rails" command is available.
The only inconvenience is that any Rubygems you install, have to be installed twice for each version (and it's better this way, since there may be incompatibilities between packages). Ruby 1.9 gems get installed in /var/lib/gems/1.9.1/ and 1.8 gems get installed in /var/lib/gems/1.8/.
Python
First install Python2.6 and Python3.0 ...
sudo aptitude install python3-all python3-dev python2.6 python2.6-devThen configure the alternatives ...
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.5 500 \ --slave /usr/share/man/man1/python.1.gz python.1.gz /usr/share/man/man1/python2.5.1.gz
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 400 \ --slave /usr/share/man/man1/python.1.gz python.1.gz /usr/share/man/man1/python2.6.1.gz
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 300 \ --slave /usr/share/man/man1/python.1.gz python.1.gz /usr/share/man/man1/python3.1.gzAnd then ...
sudo update-alternatives --config pythonOut-of-date packages?
As I'm writing this, Python has an upgrade issue in Debian testing ... giving an error about the default selected Python package, so to install Python2.6 or 3.0, it's better to update/install the latest sources of these packages, and I'd prefer to keep them from the unstable (sid) repository.To do that, first edit the file ... /etc/apt/sources.list by adding these lines ...
deb http://ftp.debian.org/debian/ unstable main non-free contrib
deb-src http://ftp.debian.org/debian/ unstable main non-free contrib
Then, create a new file (or edit the existing one if exists) in ... /etc/apt/preferences ...
Package: *
Pin: release a=testing
Pin-Priority: 700
Package: *
Pin: release a=unstable
Pin-Priority: 650
Then you can install packages from the unstable repository like so (after doing an apt-get update) ...
sudo apt-get -t unstable install python python-dev python3-all python3-dev python2.6 python2.6-devAnd the great thing about it is that whenever updates are available in the unstable repository for these packages, they will get installed automatically on apt-get upgrate.
NOTE: in Ubuntu you have to use use their repositories, not Debian's. So if you're using Ubuntu Jaunty, the newer repository would be Karmic ... which would be useful when you want to use newer packages without having to upgrade the whole distribution. So be sure to make the appropriate changes.
Enjoy ~

