Install Ruby 2.6- CentOS 7.6

Ruby language is open source, it is simple and focuses on productivity while at the same time has an elegant syntax that is easy to read and understand.

We’ll be installing the latest version released in April 2019, version 2.6.

We’ll begin with a fresh CentOS 7.6 minimal installation.

Start off by first installing the “Development Tools” group

yum groupinstall "Development Tools"

Just to cover our bases, install the epel repo

yum install epel-release

Now for the dependencies

yum install readline-devel zlib-devel libffi-devel libyaml-devel openssl-devel sqlite-devel

Note: there are other dependencies but they’ve been covered when we installed the “Development Tools” group.

Next, we need to install RVMRVM lets you install and manage multiple ruby environments. Install by issuing the following

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

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

To set up the environment

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

Install any dependencies not covered by the steps above

rvm requirements run

To list the available versions of Ruby we can install, issue the following at the shell

rvm list known

At the time of writing, Ruby 2.6 is the latest version

# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.5]
[ruby-]2.5[.3]
[ruby-]2.6[.0]
ruby-head

Install Ruby version 2.6

rvm install 2.6

If you want this version to be the default version, then do the following:

rvm use 2.6 --default

That’s it you’re done.

Last Updated: May 2, 2019 @ 11:24 pm