Cloned the rbenv repository to /usr/local/rbenv
.
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv/
Cloned ruby-build into /usr/local/rbenv/plugins
so it’s quick and easy for the system administrator to install different Ruby versions.
git clone git://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
Add the following to /etc/skel/.profile
so new users will inherit the system Ruby by default (You must also add this to each user's .bashrc for non-interactive shell sessions).
export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
export PATH="$HOME/.gem/bin:$PATH"
The above will need to be added to any existing user’s .profile
file (or equivalent). The same block also needs adding to root’s .profile
, with the exception of the Gem section, as rbenv includes gem
within the Ruby path. Next, you need to source
root’s profile (everything from this point should be done as the root user, via sudo -i
if you like).
rbenv install 1.9.3-p392
We now need to rbenv rehash
and then run rbenv global 1.9.3-p293
. At this point I also like to run gem install rbenv-rehash --no-ri --no-rdoc
which will rehash each time new Gems are installed. It also appears to do this for individual users if they install their own Gems.
we now have a working global implementation of rbenv which users can override individually by commenting the block in their .profile
and cloning rbenv
into their home directory. As it stands, this setup allows users to install their own Gems, with Gems that the root user installs being stored within /usr/local/rbenv/
.
Run:
sudo visudo
and add the following to the begining of the secure_path:
/usr/local/rbenv/shims:/usr/local/rbenv/bin: