I recently had to set up Ruby 1.8.6 on a server running Debian Etch stable. Debian is famous for its slow release cycle - Debian stable often lags far behind other Linux releases in terms of software package versions, though it provides an amazingly comprehensive set of well-tested packages and great stability, making it a great choice as a server platform.
However the current release, Etch, comes with Ruby 1.8.5, which is a bit old and has some problems running Mongrel. It’s very easy to download and compile Ruby, installing it in /usr/local, but this bypasses Debian’s packaging system. But it’s easy to do better; using Ruby’s package manager to install Ruby and maintaining all the benefits of having your installed software under package management.
Note that you’ll need to be root to run these commands.
Make sure you haven’t installed ruby in your package manager yet.
Or, if you have, uninstall it before proceeding to avoid package conflicts. Read the comments on the post below for more details.
1) Update your /etc/apt/sources.list, to use Debian’s “unstable” source packages:
deb-src ftp://debian.mirrors.tds.net/debian/ unstable main non-free contrib
2) Update your list of available packages:
apt-get update
3) Install Ruby’s build dependencies:
apt-get build-dep ruby1.8
4) Install Debian’s package management development programs:
apt-get install dpkg-dev
5) Download the Ruby source package and build it:
apt-get source -b ruby1.8
This took about 5 minutes on my system with SATA disks and a 2 gig P4. It creates the following packages:
- irb1.81.8.6.111-4all.deb
- libdbm-ruby1.81.8.6.111-4i386.deb
- libgdbm-ruby1.81.8.6.111-4i386.deb
- libopenssl-ruby1.81.8.6.111-4i386.deb
- libreadline-ruby1.81.8.6.111-4i386.deb
- libruby1.81.8.6.111-4i386.deb
- libruby1.8-dbg1.8.6.111-4i386.deb
- libtcltk-ruby1.81.8.6.111-4i386.deb
- rdoc1.81.8.6.111-4all.deb
- ri1.81.8.6.111-4all.deb
- ruby1.81.8.6.111-4i386.deb
- ruby1.8-dev1.8.6.111-4i386.deb
- ruby1.8-elisp1.8.6.111-4all.deb
- ruby1.8-examples1.8.6.111-4all.deb
6) Install the packages:
dpkg -i *.deb
You can also just install the ones you think you’ll need; at very least you’ll want ruby1.81.8.6.111-4i386.deb, and the ri, rdoc and irb packages.
7) Bask in the Ruby 1.8.6 goodness:
norman@randomba:$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]