Rubygems on Debian "one-click installer"

Before I mentioned Rails on Debian "one-click installer". Seems there is also a way to install ruby gems with apt-get on debian-like systems. It's in japanese, so just a short translation:

  • Add to your /etc/apt/sources.list:
deb http://backports.mithril-linux.org sarge-backports main contrib non-free
deb-src http://backports.mithril-linux.org sarge-backports main contrib non-free
  • Add to your /etc/apt/preferences:
Package: rubygems
Pin: release a=sarge-backports
Pin-Priority: 900
apt-get update
apt-get install rubygems

The rubygems are installed in /var/lib/gems so we need to change the PATH environment variable in order to access gem command. Inside /etc/profile:

export PATH="/var/lib/gems/1.8/bin:$PATH"
gem install rails -y