Installing Ruby on Debian

 

Home
Books
Resume
UlyCO
Comics
Living On Food
What's Your IP?
Coffee
Roasting

To get a recent version of Ruby running under Debian stable, you have to install it yourself. Well, not quite yourself, there's a very handy system called the Ruby Version Manager (RVM) to help you out.

I set up a "ruby" user, and install RVM and Ruby under that user. Then I create a short shell script "/usr/local/bin/ruby":

#!/bin/bash --
source "/home/ruby/.rvm/scripts/rvm"
ruby $@

The only real hitch is that RVM helps you out by installing any needed libraries for you, but this requires you to give the "ruby" user sudo access. I didn't want to do that, and RVM isn't as forthcoming as it used to be about what it needs to install. Fortunately, there was a helpful stackoverflow question that pointed me in the right directory, though the options have changed a bit. In particular, instead of "rvm autolibs disable" I needed to do "rvm autolibs read-fail".

Here's what I had to do.

As root, create the ruby user and install bzip2:

As ruby, install RVM's key, install RVM, and then get the requirements list:

As root, install the requirements:

As ruby, install ruby, ruby docs, and any desired gems:

Install the above "/usr/local/bin/ruby" script, use "#!/usr/local/bin/ruby" as your shebang line, and you're all set.


All material Copyright © 2006–2019 Ulysses Somers, except where otherwise noted.