How to Install Ruby 2.2.2 on CentOS

Step 1: install requirements

yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel bzip2 autoconf automake libtool bison iconv-devel sqlite-devel openssl-devel make

Step 2: Install RVM
curl -sSL | gpg –import –
curl -L | bash -s stable


[root@tutorialspots ~]# curl -sSL | gpg --import -
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <>" im
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
gpg: no ultimately trusted keys found
[root@metube src]# curl -L | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    924      0 --:--:-- --:--:-- --:--:--   923
100 24090  100 24090    0     0  45246      0 --:--:-- --:--:-- --:--:-- 45246
gpg: Signature made Sun 10 Sep 2017 08:59:21 PM UTC using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <>"
gpg:                 aka "Michal Papis <>"
gpg:                 aka "[jpeg image 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 '/usr/local/rvm/archives/rvm-1.29.3.tgz'
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=r

  * To start using RVM you need to run `source /etc/profile.d/`
    in all your open shell windows, in rare cases you need to reopen all shell w

Step 3: setup rvm environment.

source /etc/profile.d/
rvm reload

Step 4: Verify Dependencies

rvm requirements run


[root@tutorialspots ~]# rvm requirements run
Checking requirements for centos.
Requirements installation successful.

Step 5: install ruby 2.2.2

rvm install 2.2.2


[root@tutorialspots ~]# rvm install 2.2.2
Searching for binary rubies, this might take some time.
Found remote file
Checking requirements for centos.
Requirements installation successful.
ruby-2.2.2 - #configure
ruby-2.2.2 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 23.1M  100 23.1M    0     0  8124k      0  0:00:02  0:00:02 --:--:-- 8122k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.2 - #validate archive
ruby-2.2.2 - #extract
ruby-2.2.2 - #validate binary
ruby-2.2.2 - #setup
ruby-2.2.2 - #gemset created /usr/local/rvm/gems/ruby-2.2.2@global
ruby-2.2.2 - #importing gemset /usr/local/rvm/gemsets/global.gems...............
ruby-2.2.2 - #generating global wrappers........
ruby-2.2.2 - #gemset created /usr/local/rvm/gems/ruby-2.2.2
ruby-2.2.2 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated
 to empty gem list
ruby-2.2.2 - #generating default wrappers........

Step 6: Setup Default Ruby Version

rvm use 2.2.2 --default

Step 7: check ruby version

[root@tutorialspots ~]# ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

Leave a Reply