How to install Ruby 2 on Ubuntu without RVM

Mahmoud Khaled picture Mahmoud Khaled · Aug 28, 2013 · Viewed 54.8k times · Source

I want to install ruby 2.0 using

sudo apt-get install ruby2.0

But there isn't available package for ruby2.0

I want to install it using apt-get install the same like ruby 1.9.1

Any suggestions?

Answer

danmanstx picture danmanstx · Aug 28, 2013
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz
tar -xvzf ruby-2.0.0-p451.tar.gz
cd ruby-2.0.0-p451/
./configure --prefix=/usr/local
make
sudo make install

from here How do I install ruby 2.0.0 correctly on Ubuntu 12.04?

UPDATE

for ruby 2.1.5

sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz 
tar -xvzf ruby-2.1.5.tar.gz
cd ruby-2.1.5/
./configure --prefix=/usr/local
make
sudo make install

if you are still seeing an older ruby check your symlink ls -la /usr/bin/ruby from hector