Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»Install Ruby 1.9.3 ( or Multiple Ruby Version ) on CentOS, RedHat using RVM

    Install Ruby 1.9.3 ( or Multiple Ruby Version ) on CentOS, RedHat using RVM

    By RahulOctober 27, 20175 Mins Read
    Warning – Ruby 1.9 is reached to end of life and no more maintained. Kindly use below tutorials to install latest version of ruby

    Advertisement
    • Current stable – Install Ruby Latest Stable Release
    • Previous stable – Install Ruby Previous Stable Release

    Ruby programming language is becoming is more popular these days. Ruby language was created by Yukihiro “Matz” Matsumoto and first published in 1995. This article will help you to install Ruby language in CentOS, RedHat system using RVM. For this article I am using CentOS 6.5. RVM provides easy set of commands to install single or multiple versions of Ruby on single server.

    Step 1: Upgrade Packages

    It is the best practice to keep your system up to date with latest packages. Before running below command make sure that update will not affect to your running apps ( if any )on server else skip it

    # yum update
    

    Step 2: Installing Recommended Packages

    There are few developemnt libraries required to run Ruby on Linux. Use following command to install recommended packages on your server using yum.

    # 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
    

    Step 3: Install RVM ( Ruby Version Manager )

    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 -L get.rvm.io | bash -s stable
    

    [Sample Output]

      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 20511  100 20511    0     0   1120      0  0:00:18  0:00:18 --:--:-- 19722
    Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
    Creating group 'rvm'
    
    Installing RVM to /usr/local/rvm/
    Installation of RVM in /usr/local/rvm/ is almost complete:
    
      * First you need to add all users that will be using rvm to 'rvm' group,
        and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
    
      * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
        in all your open shell windows, in rare cases you need to reopen all shell windows.
    
    # Administrator,
    #
    #   Thank you for using RVM!
    #   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
    #
    # ~Wayne, Michal & team.
    
    In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
    

    Step 4: Setup RVM Environment

    After installing RVM first we need to setup rvm environment using below command.

    # source /etc/profile.d/rvm.sh
    

    Step 5: Install Required Ruby Version

    RVM provides option to manage multiple ruby version on single system. Use following command to install required version of Ruby.

    # rvm install 1.9.3
    

    [Sample Output]

    Searching for binary rubies, this might take some time.
    No binary rubies available for: centos/6/i386/ruby-1.9.3-p545.
    Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
    Checking requirements for centos.
    Installing requirements for centos.
    Updating system......
    Installing required packages: libyaml-devel......
    Requirements installation successful.
    Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p545, this may take a while depending on your cpu(s)...
    ruby-1.9.3-p545 - #downloading ruby-1.9.3-p545, 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 9802k  100 9802k    0     0   217k      0  0:00:45  0:00:45 --:--:--  393k
    ruby-1.9.3-p545 - #extracting ruby-1.9.3-p545 to /usr/local/rvm/src/ruby-1.9.3-p545.
    ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/GH-488.patch.
    ruby-1.9.3-p545 - #applying patch /usr/local/rvm/patches/ruby/ssl_no_ec2m.patch.
    ruby-1.9.3-p545 - #configuring..............................................
    ruby-1.9.3-p545 - #post-configuration.
    ruby-1.9.3-p545 - #compiling...................................................................
    ruby-1.9.3-p545 - #installing........................
    ruby-1.9.3-p545 - #making binaries executable.
    ruby-1.9.3-p545 - #downloading rubygems-2.2.2
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  404k  100  404k    0     0  25393      0  0:00:16  0:00:16 --:--:--  335k
    No checksum for downloaded archive, recording checksum in user configuration.
    ruby-1.9.3-p545 - #extracting rubygems-2.2.2.
    ruby-1.9.3-p545 - #removing old rubygems.
    ruby-1.9.3-p545 - #installing rubygems-2.2.2...............
    ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/[email protected]
    ruby-1.9.3-p545 - #importing gemset /usr/local/rvm/gemsets/global.gems.....
    ruby-1.9.3-p545 - #generating global wrappers.
    ruby-1.9.3-p545 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p545
    ruby-1.9.3-p545 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
    ruby-1.9.3-p545 - #generating default wrappers.
    ruby-1.9.3-p545 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
    Install of ruby-1.9.3-p545 - #complete
    WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:
    
        http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
    
    Please consider upgrading to ruby-2.1.1 which will have all of the latest security patches.
    Ruby was built without documentation, to build it run: rvm docs generate-ri
    

    Step 6: Install Another Version ( if Required )

    If you want using multiple versions of ruby, you can install it also using rvm else skip this step.

    # rvm install 1.8.6
    

    Step 7: Setup Default Ruby Version

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

    # rvm use 1.9.3 --default 
    
    Using /usr/local/rvm/gems/ruby-1.9.3-p545
    
    Step 8: Check Current Ruby Version

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

    # ruby --version
    
    ruby 1.9.3p545 (2014-02-24 revision 45159) [i686-linux]
    

    I hope above steps will help you for installing multiple Ruby version using RVM.

    ROR Ruby 1.9 on CentOS Ruby on Rails Ruby Version Manager rvm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    An Introduction to the “./configure” Command: Compiling Source Code in Linux

    Getting Started with Linux Command line: The Beginning

    Backing Up Your Linux System with Rsync: A Step-by-Step Guide

    View 20 Comments

    20 Comments

    1. lyman on December 8, 2015 8:05 am

      thanks for the post, it really saved my time, thanks!

      Reply
    2. Martin on February 1, 2015 5:43 am

      Thanks for this!

      Really makes things easy!

      Reply
    3. kartik on December 15, 2014 1:34 pm

      hi rahul i am beginer in ruby in rail i am using ubuntu
      in my system when i am using check ersion of ruby using
      —> sudo ruby -v
      so it return “ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]”
      without sudo i write —> ruby -v
      so it return “ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]”
      when i am set default version of ruby in rvm using –> rvm 2.0.0 use –default
      so it display ruby version in ruby 2.0.0p598
      when i install rails urin gem without sudo —> gem install rails
      so it return
      ERROR: While executing gem … (Errno::EACCES)
      Permission denied – /home/keyur/.gem/specs
      while i am using sudo —>sudo gem install rails
      it return
      ERROR: Error installing rails:
      activesupport requires Ruby version >= 1.9.3.
      i try also chnage version of ruby usinfg —> rvm 1.9.3 use –default
      after that when i check version without sudo like —>ruby -v
      so it return
      ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
      but still it return following error
      ERROR: Error installing rails:
      activesupport requires Ruby version >= 1.9.3.
      pls help how i can solve this error,
      Thanks in advance!!!

      Reply
    4. Violacase on November 21, 2014 1:00 pm

      Worked as a charm. Many thanks!

      Reply
    5. xDie on August 21, 2014 2:10 pm

      Nice Jobs man! Regards

      Reply
    6. Alberto Ghirotti on August 7, 2014 6:14 am

      Thanks for this nice article, I noted that all the commands you give are performed as root user (#), in my case all worked perfectly installing 1.9.3 into a Oracle Linux 6.5 Virtual Box Machine, but the last command (ruby –version) given from a oracle user shell (not by root) gave me 1.8.7, because /usr/bin/ruby was still the previous version.
      To enhance your answer I would add the following final steps:
      – remove previous ruby versions (#yum remove ruby); after this ruby — version from a non root terminal should give error because ruby has been removed

      – all your steps you described

      – find the path of the new (1.9.3) ruby version: /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby
      – from root prompt: #ln -s /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby /usr/bin/ruby
      – after this open a new oracle terminal and $ruby –version should give 1.9.3

      Again thank you for your work
      Alberto

      Reply
    7. Eduardo on August 3, 2014 2:19 am

      Good article!

      Reply
    8. Markandey on June 10, 2014 11:21 pm

      thank you

      Reply
    9. ananth on April 22, 2014 1:33 pm

      I hope the below config is correct.

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      [[email protected] rearview-1.2.0]# gem environment
      RubyGems Environment:
      – RUBYGEMS VERSION: 2.2.2
      – RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [x86_64-linux]
      – INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545
      – RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p545/bin/ruby
      – EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545/bin
      – SPEC CACHE DIRECTORY: /root/.gem/specs
      – RUBYGEMS PLATFORMS:
      – ruby
      – x86_64-linux
      – GEM PATHS:
      – /usr/local/rvm/gems/ruby-1.9.3-p545
      – /usr/local/rvm/gems/[email protected]
      – GEM CONFIGURATION:
      – :update_sources => true
      – :verbose => true
      – :backtrace => false
      – :bulk_threshold => 1000
      – REMOTE SOURCES:
      – https://rubygems.org/
      – SHELL PATH:
      – /usr/local/rvm/gems/ruby-1.9.3-p545/bin
      – /usr/local/rvm/gems/[email protected]/bin
      – /usr/local/rvm/rubies/ruby-1.9.3-p545/bin
      – /usr/local/rvm/bin
      – /root/jruby-1.7.12/bin
      – /usr/lib64/qt-3.3/bin
      – /usr/local/sbin
      – /usr/local/bin
      – /sbin
      – /bin
      – /usr/sbin
      – /usr/bin
      – /root/bin
      – /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Reply
    10. ananth on April 22, 2014 1:31 pm

      thanks a ton for step by step installation

      Reply
    11. shyam krishna khadka on April 18, 2014 11:57 am

      I have problem with installation , when I run yum install gcc-c++ patch readline readline-devel zlib zlib-devel command, I got errors as
      Trying other mirror.
      : [Errno 14] PYCURL ERROR 22 – “The requested URL returned error: 404”
      Trying other mirror.

      My repos infos are as below :
      ls -l /etc/yum.repos.d/
      total 28
      -rw-r–r–. 1 root root 1926 Jun 26 2012 CentOS-Base.repo
      -rw-r–r–. 1 root root 637 Jun 26 2012 CentOS-Debuginfo.repo
      -rw-r–r–. 1 root root 626 Jun 26 2012 CentOS-Media.repo
      -rw-r–r–. 1 root root 2593 Jun 26 2012 CentOS-Vault.repo
      -rw-r–r– 1 root root 957 Apr 18 16:23 epel.repo
      -rw-r–r– 1 root root 1056 Nov 5 2012 epel-testing.repo
      -rw-r–r– 1 root root 332 Jul 20 2011 rbel6.repo

      My centos version is as
      #cat /etc/issue
      CentOS release 6.3 (Final)
      Kernel r on an m

      Please help me.

      Reply
      • Rahul on April 19, 2014 3:34 am

        Hi Shyam,

        Add REMI and CentAlt yum repositories in your system http://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/

        clean all yum cache before installing packages.

        yum clean all

        Reply
        • shyam krishna khadka on April 20, 2014 9:13 am

          Today it worked itself. I didn’t add any yum repository. I had added EPEL repos already but was not working.
          Thanks for suggestion.

          Reply
    12. Ian Lewis on August 14, 2013 11:00 am

      Hi,

      Thanks for the low down.

      I have followed your steps and enabled 1.9.3 with RVM but I can’t see it operating systemwide. When I log in to the server (as a regular user) I still see ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

      Can you make any suggestions.

      Thanks,
      Ian

      Reply
      • Roopashree on May 14, 2014 11:36 am

        Hi Ian,

        even i am facing the same issue, can you please help me if you have solved the issue.

        Reply
        • Rahul on May 15, 2014 5:12 am

          Hi Roopashree,

          I assume you must have executed following command to make 1.9.3 as default .

          # rvm use 1.9.3 –default

          Can you check version immediate after running above command

          # ruby –version

          Reply
    13. ejohn on June 11, 2013 7:21 pm

      Awesome post !… thanks so much

      Reply
    14. Shahbaz on March 14, 2013 3:08 pm

      Nice article , thanks , all the required info in one place. Btw have you tried to install gem “capybara-webkit”, does it install without any objection ?

      Thanks again for the article.

      Reply
      • admin on March 15, 2013 2:46 am

        Hi Shahbaz,

        In order to install capybara-webkit, You need to set QMAKE environment variable.
        Install qt47-webkit-devel rpm and set QMAKE using below command.
        export QMAKE=/usr/bin/qmake-qt47

        Hope it will help you… If you still face issue, let me know what OS and version are you using…

        Reply
        • Shahbaz on March 18, 2013 11:32 am

          Hi,
          Ah!!! Finally solved it, cause I was installing on CentOS 5.8, and after installing qt47 when its time to install caypybara-webkit, it will look for qt47 on usr/lib/bin , but qt47 resides on usr/lib64/bin. If ‘export PATH’ doesn’t work on 5.8 then just create a symlink to lib64.
          Thanks again for all the help.
          Cheers.

          Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.