I dont know how to install the latest Ruby on Ubuntu.
First I installed the default Ruby 1.9.3, using
sudo apt-get install ruby
Then I tried to install the 2.0 version using
sudo apt-get install ruby2.0
My version of Ruby is still "ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux])"
What should I do?
This question is related to
ruby
ubuntu
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 -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux-gnu]
Use RVM (Ruby Version Manager) to install and manage any versions of Ruby. You can have multiple versions of Ruby installed on the machine and you can easily select the one you want.
To install RVM type into terminal:
\curl -sSL https://get.rvm.io | bash -s stable
And let it work. After that you will have RVM along with Ruby installed.
Source: RVM Site
update ubuntu:
sudo apt-get update
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
Install rvm, which manages the ruby versions:
to install rvm use the following command.
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.bash_profile
rvm install ruby-2.1.4
Check ruby versions installed and in use:
rvm list
rvm use --default ruby-2.1.4
Best is to install it using rvm(ruby version manager).
Run following commands in a terminal:
sudo apt-get update
sudo apt-get install build-essential make curl
\curl -L https://get.rvm.io | bash -s stable
source ~/.bash_profile
rvm install ruby-2.1.4
Then check ruby versions installed and in use:
rvm list
rvm 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
Source: Stackoverflow.com