How to install Ruby 2.1.4 on Ubuntu 14.04
There is a PPA with up-to-date versions of Ruby 2.x for Ubuntu 12.04+:
$ sudo apt-add-repository ppa:brightbox/ruby-ng$ sudo apt-get update$ sudo apt-get install ruby2.4$ ruby -vruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux-gnu]
First of all, install the prerequisite libraries:
sudo apt-get updatesudo 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
Then install rbenv, which is used to install Ruby:
cdgit clone https://github.com/rbenv/rbenv.git ~/.rbenvecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrcecho 'eval "$(rbenv init -)"' >> ~/.bashrcexec $SHELLgit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-buildecho 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrcexec $SHELLrbenv install 2.3.1rbenv global 2.3.1ruby -v
Then (optional) tell Rubygems to not install local documentation:
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
Credits: https://gorails.com/setup/ubuntu/14.10
Warning!!!There are issues with Gnome-Shell
. See comment below.
Best is to install it using rvm(ruby version manager).
Run following commands in a terminal:
sudo apt-get updatesudo apt-get install build-essential make curl\curl -L https://get.rvm.io | bash -s stablesource ~/.bash_profilervm install ruby-2.1.4
Then check ruby versions installed and in use:
rvm listrvm use --default ruby-2.1.4
Also you can directly add ruby bin path to PATH variable. Ruby is installed in
$HOME/.rvm/rubies export PATH=$PATH:$HOME/.rvm/rubies/ruby-2.1.4/bin