Thanks to http://www.vxnick.com/blog/2012/04/setting-up-rbenv-globally/ for the steps, I'm assembling them into a gist for future reference.
apt-get install git
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
Clone rbenv
and the ruby-build
plugin down to /usr/local/rbenv
.
sudo git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
sudo git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins
Modify /etc/skel/.profile to include:
#### begin rbenv configuration ####
## Remove these lines if you wish to use your own
## clone of rbenv (with your own rubies)
export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
# Allow local Gem management
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
export PATH="$HOME/.gem/bin:$PATH"
#### end rbenv configuration ####
Be sure to add that snippet to any existing users additionally.
The following steps should be run as root, so su
is very helpful
rbenv install 1.9.3-p125
rbenv global 1.9.3-p125
rbenv rehash
A useful gem for automatic rehashing is:
gem install rbenv-rehash
And TADA! we have a global rbenv
install.