How to Install Ruby 2.4.0 on CentOS/RHEL with RVM

Ruby 2.4.0 is a dynamic, object-oriented programming language.We are using RVM, which stands for Ruby Version Manager. RVM is a command-line tool which allows you to easily install, manage and work with multiple ruby version of Ruby without conflicting. Also as per our requirement, we can switch the Ruby version very easily.

Ruby 2.4.0

See Also:
1. How to Install Ruby 2.3.3 on CentOS/RHEL with RVM
2. How to Install Ruby 2.2.4 on CentOS/RHEL with RVM
3. How To Deploy a Rails Application with Apache using Phusion Passenger
4. How To Install Ruby on Rails on Ubuntu using RVM

This article we will explain you to How to Install Ruby 2.4.0 on CentOS/RHEL using RVM.

Step 1: Install Required Packages

Firstly we need to install all required packages on our system using following command.

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

Step 2: Install RVM

Now install latest version of RVM on your system using following command.

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

Now use below command to setup rvm environment.

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

Step 3: Verify Dependencies

Now use following command to verify all dependencies are installed or not.

# rvm requirements run
Checking requirements for centos.
Requirements installation successful.

Step 4: Install Ruby 2.4.0

Now, lets install Ruby language using following command.

# rvm install 2.2.4

Step 5: Setup Default Ruby Version

Now first check currently installed ruby versions on your system.

# rvm list
rvm rubies

 * ruby-2.2.4 [ x86_64 ]
=> ruby-2.3.3 [ x86_64 ]
   ruby-2.4.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

After that use rvm command to setup default ruby version.

# rvm use 2.4.0 --default
Using /usr/local/rvm/gems/ruby-2.4.0

Step 6: Verify Ruby Version

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

# ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

Congratulation’s you have successfully install Ruby on your system. Read our next article to integrate Ruby with Apache web server with easy steps.

References:
1: http://rvm.io/rubies/installing

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.