Installing rbenv
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
~/.rbenv/bin/rbenv init
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Disable rubygems to generate local documentation for each gem that you install
echo "gem: --no-document" > ~/.gemrc
Restart your shell so that PATH changes take effect. (Opening a new terminal tab will usually do it.) or run:
source ~/.bashrc
Now check if rbenv was set up:
type rbenv
Install ruby-build
It provides the rbenv install
command that simplifies the process of installing new Ruby versions.
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
References
How To Install Ruby on Rails with rbenv on Ubuntu 14.04 - Digitalocean
Install rbenv - Github
Install ruby-build - Github