1. Install RVM and refer to https://rvm.io/

 -- gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

 -- \curl -sSL https://get.rvm.io | bash -s stable


[jiaxiaol@usda5p-scop01-admtool ~]$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: directory `/home/jiaxiaol/.gnupg' created
gpg: new configuration file `/home/jiaxiaol/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/jiaxiaol/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/jiaxiaol/.gnupg/secring.gpg' created
gpg: keyring `/home/jiaxiaol/.gnupg/pubring.gpg' created
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: requesting key 39499BDB from hkp server keys.gnupg.net
gpg: /home/jiaxiaol/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) " imported
gpg: key 39499BDB: public key "Piotr Kuczynski " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 2
gpg:               imported: 2  (RSA: 2)
[jiaxiaol@usda5p-scop01-admtool ~]$
[jiaxiaol@usda5p-scop01-admtool ~]$ \curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.2.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.2/1.29.2.tar.gz.asc
gpg: Signature made Thu 22 Jun 2017 04:18:38 PM GMT using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) "
gpg:                 aka "Michal Papis "
gpg:                 aka "[jpeg p_w_picpath of size 5015]"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 409B 6B17 96C2 7546 2A17  0311 3804 BB82 D39D C0E3
     Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36  166B E206 C29F BF04 FF17
GPG verified '/home/jiaxiaol/.rvm/archives/rvm-1.29.2.tgz'
Installing RVM to /home/jiaxiaol/.rvm/
    Adding rvm PATH line to /home/jiaxiaol/.profile /home/jiaxiaol/.mkshrc /home/jiaxiaol/.bashrc /home/jiaxiaol/.zshrc.
    Adding rvm loading line to /home/jiaxiaol/.profile /home/jiaxiaol/.bash_profile /home/jiaxiaol/.zlogin.
Installation of RVM in /home/jiaxiaol/.rvm/ is almost complete:
  * To start using RVM you need to run `source /home/jiaxiaol/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.
# jiaxiaol,
#
#   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: https://rvm.io/help and https://twitter.com/rvm_io
  * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/home/jiaxiaol/.bash_profile':
      source ~/.profile

2. Check the available version

[jiaxiaol@usda5p-scop01-admtool ~]$ rvm list known




3. Install ruby 2.4.0:

[jiaxiaol@usda5p-scop01-admtool ~]$ rvm install 2.4.0
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.4.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: libyaml-devel, readline-devel, libffi-devel, sqlite-devel.........
Requirements installation successful.
Installing Ruby from source to: /home/jiaxiaol/.rvm/rubies/ruby-2.4.0, this may take a while depending on your cpu(s)...
ruby-2.4.0 - #downloading ruby-2.4.0, 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 11.9M  100 11.9M    0     0  6499k      0  0:00:01  0:00:01 --:--:-- 6499k
ruby-2.4.0 - #extracting ruby-2.4.0 to /home/jiaxiaol/.rvm/src/ruby-2.4.0....
ruby-2.4.0 - #configuring..................................................................
ruby-2.4.0 - #post-configuration..
ruby-2.4.0 - #compiling.................................................................................
ruby-2.4.0 - #installing...........................
ruby-2.4.0 - #making binaries executable..
ruby-2.4.0 - #downloading rubygems-2.6.12
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  749k  100  749k    0     0  2842k      0 --:--:-- --:--:-- --:--:-- 2851k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.4.0 - #extracting rubygems-2.6.12....
ruby-2.4.0 - #removing old rubygems.........
ruby-2.4.0 - #installing rubygems-2.6.12.........................
ruby-2.4.0 - #gemset created /home/jiaxiaol/.rvm/gems/ruby-2.4.0@global
ruby-2.4.0 - #importing gemset /home/jiaxiaol/.rvm/gemsets/global.gems...............................................
ruby-2.4.0 - #generating global wrappers........
ruby-2.4.0 - #gemset created /home/jiaxiaol/.rvm/gems/ruby-2.4.0
ruby-2.4.0 - #importing gemsetfile /home/jiaxiaol/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.4.0 - #generating default wrappers........
ruby-2.4.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.4.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
[jiaxiaol@usda5p-scop01-admtool ~]$
[jiaxiaol@usda5p-scop01-admtool ~]$ rvm list
rvm rubies
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
#  * - default
[jiaxiaol@usda5p-scop01-admtool ~]$