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 https://rvm.io/mpapis.asc | gpg --import -
curl -L get.rvm.io | bash -s stable

result:

[root@tutorialspots ~]# curl -sSL https://rvm.io/mpapis.asc | 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
run
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) <mpapis@gmail.com>" im
ported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
gpg: no ultimately trusted keys found
[root@tutorialspots src]# curl -L get.rvm.io | 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
Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.as
c
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) <mpapis@gmail.com>"
gpg:                 aka "Michal Papis <michal.papis@toptal.com>"
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
wx,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 w
indows.

If you get error:

gpg: Signature made Thu 13 Dec 2018 10:09:53 PM +07 using RSA key ID 39499BDB
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).

GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.6.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.6/1.29.6.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:

    gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275461A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6955105BD0E739499BDB

or if it fails:

    command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

the key can be compared with:

    https://rvm.io/mpapis.asc or https://keybase.io/mpapis
    https://rvm.io/pkuczynski.asc

NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.

You must do these steps:

rpm -e --nodeps gnupg2
yum install gnupg1

Then you must use gpg1 instead of gpg

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

Step 3: setup rvm environment.

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

Step 4: Verify Dependencies

rvm requirements run

result:

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

Step 5: install ruby 2.2.2

rvm install 2.2.2

result:

[root@tutorialspots ~]# rvm install 2.2.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/centos/7/x86_64/
ruby-2.2.2.tar.bz2
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]

1 Comment

Leave a Reply