2014-07-28

Installing Ruby 2.1+ on Ubuntu (via RVM)

On some distro, Ruby interpreter was out of date

apt-cache show ruby2.0 | grep Version
Version: 2.0.0.484-1ubuntu2

And we want the latest version, we could use Brightbox's PPA:

# install add-apt-repository command
sudo apt-get install software-properties-common python-software-properties

# add brightbox's repository
sudo apt-add-repository ppa:brightbox/ruby-ng

# update list of available software
sudo apt-get update

# install ruby
sudo apt-get install ruby2.1

Or use RVM, the Ruby Version Manager, that could be installed using these commands:

# install rvm
curl -sSL https://get.rvm.io | bash

# use rvm (or relogin/restart bash, since it's inserted into .bashrc)
source /etc/profile.d/rvm.sh

to see the list of available version, we could use:

rvm list known

to install the latest version, run this command:

rvm install ruby-2.1.2
ruby-2.1.2 - #removing src/ruby-2.1.2..
ruby-2.1.2 - #removing rubies/ruby-2.1.2..
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/14.04/x86_64/ruby-2.1.2.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.2 - #configure
ruby-2.1.2 - #download
######################################################################## 100.0%
ruby-2.1.2 - #validate archive
ruby-2.1.2 - #extract
ruby-2.1.2 - #validate binary
ruby-2.1.2 - #setup
ruby-2.1.2 - #gemset created /usr/local/rvm/gems/ruby-2.1.2@global
ruby-2.1.2 - #importing gemset /usr/local/rvm/gemsets/global.gems....................................
ruby-2.1.2 - #generating global wrappers........
ruby-2.1.2 - #gemset created /usr/local/rvm/gems/ruby-2.1.2
ruby-2.1.2 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.2 - #generating default wrappers........
Making gemset ruby-2.1.2 pristine.............................................................
Making gemset ruby-2.1.2@global pristine..............................................................


Voila, done! now we could use it using this command:

rvm use ruby-2.1.2 

ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

gem install pry
Fetching: coderay-1.1.0.gem ( 52%)
Fetching: coderay-1.1.0.gem (100%)
Successfully installed coderay-1.1.0
Fetching: slop-3.6.0.gem (100%)
Successfully installed slop-3.6.0
Fetching: method_source-0.8.2.gem (100%)
Successfully installed method_source-0.8.2
Fetching: pry-0.10.0.gem (100%)
Successfully installed pry-0.10.0
invalid options: -SNw2
(invalid options are ignored)
Parsing documentation for coderay-1.1.0
Installing ri documentation for coderay-1.1.0
Parsing documentation for method_source-0.8.2
Installing ri documentation for method_source-0.8.2
Parsing documentation for pry-0.10.0
Installing ri documentation for pry-0.10.0
Parsing documentation for slop-3.6.0
Installing ri documentation for slop-3.6.0
Done installing documentation for coderay, method_source, pry, slop after 4 seconds
4 gems installed




No comments :

Post a Comment

THINK: is it True? is it Helpful? is it Inspiring? is it Necessary? is it Kind?