System

Steps to install Ruby Version Manager (RVM) on CentOS 6

Ruby Version Manager (RVM) CentOS 6 uses Ruby 1.8.7, an old version, while some applications require newer Ruby. Upgrading it directly may disrupt operation. Ruby Version Manager (RVM) lets us install the required Ruby version without affecting the main system. Ruby Version Manager (RVM) lets us use multiple Ruby versions on one machine, making it easy to select the appropriate version for each application without affecting the existing system, since all processes run at user level. Install Ruby Version Manager (RVM)

  1. Install the related packages to prepare for installation.

    [root@Ezylinux ~]# yum groupinstall "Development Tools"
    [root@Ezylinux ~]# yum install readline-devel, zlib-devel, libyaml-devel, libffi-devel, openssl-devel, libxml2-devel, libxslt-devel
  2. Install RVM with:

    [root@Ezylinux ~]# curl -L get.rvm.io | bash -s stable
  3. Installation creates an RVM group. Add users who need RVM to this group using usermod. The example below adds root to the rvm group.

    [root@Ezylinux ~]# usermod -a -G rvm root
  4. To start using RVM, run:

    [root@Ezylinux ~]# source /etc/profile.d/rvm.sh

Install and use another Ruby version

  1. Check the current Ruby version with:

    [root@Ezylinux ~]# ruby -v
    ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  2. Enable autolibs with:

    [root@Ezylinux ~]# rvm autolibs enable
  3. Install another Ruby version with:

    # rvm install RUBYVERSION 

    For example, install Ruby 1.9.3:

    [root@Ezylinux ~]# rvm install 1.9.3
  4. After installation, select the required Ruby version with:

    # rvm use RUBYVERSION 

    For example, use Ruby 1.9.3:

    [root@Ezylinux ~]# rvm use 1.9.3
  5. Check the active Ruby version again with:

    [root@Ezylinux ~]# ruby -v
    ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
EOF.← Back to articles