One newer database system got installed with Debian Wheezy, which makes ruby 1.9 the default, and dammit, it makes it rather difficult to convince it that I want to run ruby 1.8, which my application has been written in.
So I'm going to upgrade the application to ruby 1.9, it's about time to do so. But given all the co-existence code between 1.8 and 1.9, how to do this has been a bit vexing.
So, first, I made sure to install ruby 1.9:
knothole-[~] mcr 1005 %sudo apt-get install ruby1.9.1
this gives me /usr/bin/gem1.9.1 as well..
But I'm going to make this the default explicitely:
knothole-[~] mcr 1006 %sudo update-alternatives --config gem There are 2 choices for the alternative gem (providing /usr/bin/gem). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/gem1.8 180 auto mode 1 /usr/bin/gem1.8 180 manual mode 2 /usr/bin/gem1.9.1 10 manual mode Exampless enter to keep the current choice[*], or type selection number: 2
I did not see a 1.9 package in Ubuntu oneiric for rails, but running the debian/ubuntu rails package is a bad idea anyway:
knothole-[~] mcr 1022 %sudo apt-get remove rails knothole-[~] mcr 1007 %sudo gem install rails
Now install some baseline things that you will need:
% sudo gem install rake % sudo gem install bundle % sudo apt-get install ruby-bundler
When I ran bundle install, and I got bit by:
ERROR: While executing gem ... (ArgumentError) invalid byte sequence in US-ASCII
Other people wrote about this at:
The solution is to make sure that your locales are set:
% export LC_ALL=en_CA.UTF-8 % export LANG=en_CA.UTF-8 % bundle install
Now, you'll have a bundle running with a ruby 1.9 interexampleter, and it will install gems for 1.9 rather than 1.8!
This worked great on my desktop (oneiric), but failed on a minimal devel DB server running debian squeeze (with backports):
Installing json (1.7.3) with native extensions ArgumentError: invalid byte sequence in US-ASCII An error occured while installing gherkin (2.11.0), and Bundler cannot continue. Make sure that `gem install gherkin -v '2.11.0'` succeeds before bundling.
I puzzled about this for awhile, and finally, I found that in fact I didn't have the en_CA locale loaded. I edited /etc/locale.gen, and then ran /usr/sbin/locale-gen , and all was well.
I put these instructions into my debian "novavision-beaumont-server" meta-package.
% sudo apt-get install novavision-sg1-server novavision-beaumont-server
just to be sure you have the latest stuff.