Debian – Install Ruby gems via gems or using apt-get on Debian

aptdebiangemgitruby

I would like to install gitorious on my Debian squeeze server. For doing so I have to install some gems like the ruby database driver for MySQL.

I have the choice of using a Debian package and install it via apt-get or use gem to install it. To make the latter work I installed the necessary development packages of MySQL.

So it works fine until now.

My question is: What is easier in the long run: using the language's specific package manager like gem for Ruby, CPAN for Perl, etc. or is it better to look for Debian packages of these extensions?

I appreciate the ideas and best practices of better admins than me.

Best Answer

That depends heavily on what software you intend to use. Generally, I'd advise you to either install ALL ruby packages from source (i.e using rubygems) or stick to debs. Mixing both sources is going to cause some serious pain. If you intend to use rubygems, you should consider installing rubygems itself from source. The package from Lenny at least used to behave a bit differently from upstream to accommodate the Debian changes. I don't know for sure if that is still the case in Squeeze.

Using deb packages as the advantage of having to rely on just one package manager and getting (security) updates for free. The downside is less flexibility, as you can have only one mandated version of a gem installed.

The rubygems approach brings you more flexibility, as you can install any package you like and can have multiple versions of them. However, you have look out for dependencies, security upgrades, ... yourself. Ruby gems tend to have not that rigorous dependencies specified, so it can happen that packages specify package versions as allowed dependencies which actually break stuff. You need to read the docs here.

In the end, it depends in your actual use-case. If most (or all) of your tools are available as debian packages and the versions suit your requirements, you should go that way. If you need more, go with the gem route all the way. And in that case, I would like to interest you in RVM which allows you to manage all aspects of your ruby install independently from the underlying OS. You can even install multiple ruby versions and sets of installed gems for multiple applications.

Related Topic