Install Ruby 2.3.1 from Source on Ubuntu 16.04

Execute this as the root user. If not, you can always add sudo. Here’s the script:


#!/bin/bash

set -e

apt-get update
apt-get install -y curl build-essential libreadline-dev \
libffi-dev zlib1g-dev openssl vim \
libncurses5-dev libcurl4-openssl-dev \
libgdbm-dev libqdbm-dev libssl-dev
apt-get autoremove && apt-get autoclean
curl -O https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar xvzf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure
make && make install
cd ..
rm -rf ruby-2.3.1*
echo "gem: --no-ri --no-rdoc
install: --no-ri --no-rdoc
update: --no-ri --no-rdoc" > /usr/local/etc/gemrc

gem install bundler pry interactive_editor