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

How do I install ruby 2.0.0 correctly on Ubuntu 12.04?


follow below steps

sudo apt-get -y updatesudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-devcd /tmpwget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gztar -xvzf ruby-2.0.0-p481.tar.gzcd ruby-2.0.0-p481/./configure --prefix=/usr/localmakesudo make install


Use rvm to install stable ruby:

curl -sSL https://get.rvm.io | bash -s stable --ruby

or, if you have rvm already, get stable version:

rvm get stable

Install ruby and use the specific version of ruby (remember to use login shell)

/bin/bash --loginrvm install 2.0.0rvm use 2.0.0rvm rubygems latestruby --version

As found on the official RVM website.

EDIT: As @prem points out run this at first and follow the above steps if there is a public key error

gpg --keyserver hkp://keys.gnupg.net --recv-keys \ 409B6B1796C275462A1703113804BB82D39DC0E3

Use rbenv to install ruby:

Install necessary dependancies:

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 rbenv:

cdgit clone git://github.com/sstephenson/rbenv.git .rbenvecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profileecho 'eval "$(rbenv init -)"' >> ~/.bash_profilegit clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-buildecho 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profilesource ~/.bash_profile

Install ruby:

rbenv install -v 2.0.0


From the travis-cli installation instructions for Ubuntu, the Brightbox Ruby NG(NextGeneration) ppa:

$ sudo apt-get install python-software-properties$ sudo apt-add-repository ppa:brightbox/ruby-ng$ sudo apt-get update$ sudo apt-get install ruby2.1 ruby-switch$ sudo ruby-switch --set ruby2.1