rvm for Ruby versioning on CentOS

Lately I have been working with ruby for scripting system administration tasks, and monitoring applications. I am really liking rvm for managing my ruby versions. It keeps different versions of ruby and gems cleanly organized and allow me to easily switch back and forth between ruby versions.  rvm also automates the downloading and compilation of ruby binaries, and performs this in a very clean way, which I love cleanliness on my systems (filesystem neat freak). Lets jump right into rvm.

To install rvm on CentOS:

Step 1) 

[root@eyeball rvm]# mkdir -p ~/.rvm/src/&& cd ~/.rvm/src && rm -rf ./rvm/&& git clone depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm &&./install

Step 2)

[root@eyeball rvm]# source ~/.rvm/src/rvm/scripts/rvm

Step 3)

Add the follwing to your .bash_profile or .bashrc in your home directory

if[[-s /Users/YOURUSERNAME/.rvm/scripts/rvm ]];then source /Users/YOURUSERNAME/.rvm/scripts/rvm ;fi

Step 4)

Install a new version of ruby using rvm!

[root@eyeball rvm]# rvm install 1.9.3

[root@eyeball rvm]# ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

NOTE: If you install rvm as root, it will be available globally to all users under /usr/local/rvm. If you install it as a regular user, the various ruby distributions and their respective gems will be installed under that users home directory.

As you can see I can easily install a different version of ruby, and it will be stored in a separate location. 

[root@eyeball rvm]# rvm install 1.8.5

[root@eyeball rvm]# rvm –default 1.8.5

[root@eyeball rvm]# ruby -v
ruby 1.8.5 (2008-06-20 patchlevel 231) [x86_64-linux] 

[root@eyeball rvm]# ls -l /usr/local/rvm/rubies
total 8
lrwxrwxrwx. 1 root rvm 37 May 31 13:57 default -> /usr/local/rvm/rubies/ruby-1.8.5-p231
drwxr-xr-x. 5 root rvm 4096 May 31 13:54 ruby-1.8.5-p231
drwxr-xr-x. 6 root rvm 4096 May 31 13:31 ruby-1.9.3-p194

Conclusion: rvm is pretty amazing for managing your ruby distributions, and makes it very simple and easy to download, build, compile, and manage  ruby distributions. Enjoy!

The official rvm documentation is available at https://rvm.io/ 

Note: Some of the steps for installation were borrowed from http://portertech.ca/2010/03/26/homebrew–rvm–awesome/ which I found to be one of the more reliable methods for installing rvm vs. other documentation available.

Pre-Alpha Version of Pro Web Development and Operations Available

After much careful attention to detail and gracious effort from my wonderful publisher, Apress, Pro Website Development and Operations is now available for purchase under their Alpha program at a discount. Check out the book and learn about the inside information and get the missing manual to working in teams working on high traffic Websites. Streamline and increase efficiency between not just development and operations, but business management, project management, and marketing as well, and get an advance look into the content of the book!

Order Here