Centos 6/RHEL install RVM, Ruby 2.0.3 with RubyGems

This post runs through the installation of Ruby Version Manager with Ruby and Rubygems on Centos 6/RHEL.

Ruby is an object orientated language developed by Yukihiro Matsumoto in the mid 90s.

It is very popular especially in the Far East where, unsurprisingly, there are exponents of considerable talent.

It is used for Ruby on Rails and Sproutcore amongst other applications and has a vibrant online community.

It is fairly straighforward to install on Centos6/RHEL using RVM (ruby version manager) although it can get a little more involved in situations such as multi user servers.

We don't use the repo version as that is old and has no rubygems.

To install RVM and the latest version of ruby (2.0.3) including rubygems as A SINGLE USER.

If you have ruby installed, remove it with

$ sudo yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs

Install dependencies

$ sudo yum -y install openssl-devel zlib-devel gcc gcc-c++ make autoconf automake readline-devel curl curl-devel expat-devel gettext-devel libtool bison patch zlib libyaml-devel bzip2

$ sudo su

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

press 'q'at the prompt and wait, it takes a while

# exit                 

$ source /home/<user_name>/.rvm/scripts/rvm  OR

# source /usr/local/rvm/scripts/rvm 

Ruby installation Centos 6

Other example commands

$ irb                            interactive ruby
2.0.0p247 :001 >

# gem install sproutcore         gives you sproutcore

# gem install rails              gives you ruby on rails

# gem install pry pry-doc        gives you pry (irb alternative)

$ gem --version


$ ruby --version

ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]

$ rvm --version

rvm 1.21.5 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

$ rvm notes                     gives you other information

Labels: , , , ,