• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Ruby 2.2.4 on CentOS/RHEL with RVM

Written by Rahul, Updated on February 7, 2017

Ruby 2.2.4 Released, This is an upgrade of Ruby 2.2 series. Ruby is a dynamic, object-oriented programming language.We are using RVM, which stands for Ruby Version Manager, which makes easier to install Ruby on Linux platform. RVM is also helpful for managing multiple version of Ruby without conflicting, and we can switch system to any version of Ruby using a single command.

This article will help you to How to Install Ruby 2.2.4 on CentOS, Red Hat Systems using RVM.

Step 1: Install Required Packages

Firstly we need to install all required packages for ruby installation on our system using following command.

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel sqlite-devel
Step 2: Install RVM

Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.

# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
# curl -L get.rvm.io | bash -s stable

Now use below command to setup rvm environment.

# source /etc/profile.d/rvm.sh
# rvm reload
Step 3: Verify Dependencies

Now use following To verify all dependencies are properly installed.

# rvm requirements run

Checking requirements for centos.
Requirements installation successful.
Step 4: Install Ruby 2.2

After completing setup of RVM environment, lets install Ruby language using following command.

# rvm install 2.2.4

[Sample Output]

Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.2.4.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.2.4, this may take a while depending on your cpu(s)...
ruby-2.2.4 - #downloading ruby-2.2.4, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.7M  100 12.7M    0     0  33.5M      0 --:--:-- --:--:-- --:--:-- 33.6M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting ruby-2.2.4 to /usr/local/rvm/src/ruby-2.2.4....
ruby-2.2.4 - #configuring...................................................
ruby-2.2.4 - #post-configuration..
ruby-2.2.4 - #compiling.....................................................
ruby-2.2.4 - #installing............................
ruby-2.2.4 - #making binaries executable..
ruby-2.2.4 - #downloading rubygems-2.4.8
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  437k  100  437k    0     0  2367k      0 --:--:-- --:--:-- --:--:-- 2376k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.4 - #extracting rubygems-2.4.8....
ruby-2.2.4 - #removing old rubygems.........
ruby-2.2.4 - #installing rubygems-2.4.8......................
ruby-2.2.4 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-2.2.4 - #importing gemset /usr/local/rvm/gemsets/global.gems...............................................
ruby-2.2.4 - #generating global wrappers........
ruby-2.2.4 - #gemset created /usr/local/rvm/gems/ruby-2.2.4
ruby-2.2.4 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.4 - #generating default wrappers........
ruby-2.2.4 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.2.4 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Step 5: Setup Default Ruby Version

Use rvm command to setup default ruby version to be used by applications.

# rvm use 2.2.4 --default

Using /usr/local/rvm/gems/ruby-2.2.4
Step 6: Check Current Ruby Version.

Using following command you can check the current ruby version is used.

# ruby --version

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]

Congratulation’s you have successfully install Ruby on your system. Read our next article to integrate Ruby with Apache web server with easy steps.

References:
1. http://rvm.io/rubies/installing

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

4 Comments

  1. Avatar Anony Reply
    March 3, 2018 at 10:02 am

    Thank u

  2. Avatar Mesophoyx Reply
    August 26, 2017 at 9:55 pm

    Thanks for the post just what i needed.

  3. Avatar Tim Reply
    July 12, 2016 at 2:45 am

    This install did not work on RH 7.x

    -bash-4.2$ rvm requirements run
    Checking requirements for redhat.
    Unable to locate SystemId file. Is this system registered?
    Unable to locate SystemId file. Is this system registered?
    Enabling optional repository

    Then it ask for username and passwd

    • Avatar Tim Reply
      July 12, 2016 at 4:03 am

      Thx… I fix the error by installing a development version of my libyaml.

Leave a Reply Cancel reply

Popular Posts

  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • (Solved) apt-add-repository command not found – Ubuntu & Debian 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy