Install ruby by rbenv
# install gcc make
sudo apt-get install -y gcc make libssl-dev libreadline-dev zlib1g-dev
# install rbenv ruby-build ruby2.3.1
if [ ! -e ~/.rbenv ]; then
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
mkdir -p ~/.rbenv/plugins
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
cat <<'EOT' >> ~/.bash_profile
if [ -e ~/.rbenv ]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
EOT
source ~/.bash_profile
fi
# install ruby
source ~/.bash_profile
version="2.3.1"
rbenv install $version
rbenv rehash
rbenv global $version
sudo apt-get update
sudo apt-get install ruby-dev ruby2.3-dev