In this tutorial, we will install ruby 2.4 with RVM on Centos /RHEL 7/6.
Ruby is a dynamic, interpreted, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro “Matz” Matsumoto in Japan.
According to the creator, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, and Lisp. It supports multiple programming paradigms, including functional, object-oriented, and imperative.
Read Also: Capistrano Slack integration for deployment
Install RVM
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
\curl -sSL https://get.rvm.io | bash -s stable
Also, To start using RVM you need to run
source /etc/profile.d/rvm.sh
Read Also: Capistrano rollback specific version
Install Ruby 2.4.1
Now after successful installation of rvm now we will install ruby and manage ruby using rvm.
rvm install 2.4.1
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.4.1.tar.bz2
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: patch, autoconf, automake, bison, bzip2, gcc-c++, libffi-devel, libtool, make, patch, readline-devel, sqlite-devel, zlib-devel, glibc-headers, glibc-devel, openssl-devel....-
Requirements installation successful.
ruby-2.4.1 - #configure
ruby-2.4.1 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14.1M 100 14.1M 0 0 1037k 0 0:00:13 0:00:13 --:--:-- 3119k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.4.1 - #validate archive
ruby-2.4.1 - #extract
ruby-2.4.1 - #validate binary
Libraries missing for ruby-2.4.1: libyaml-0.so.2. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.4.1, this may take a while depending on your cpu(s)...
ruby-2.4.1 - #downloading ruby-2.4.1, 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 10.2M 0 0:00:01 0:00:01 --:--:-- 10.2M
ruby-2.4.1 - #extracting ruby-2.4.1 to /usr/local/rvm/src/ruby-2.4.1.....
ruby-2.4.1 - #applying patch /usr/local/rvm/patches/ruby/2.4.1/random_c_using_NR_prefix.patch.
ruby-2.4.1 - #configuring..................................................................
ruby-2.4.1 - #post-configuration..
ruby-2.4.1 - #compiling..................................................................................................................
ruby-2.4.1 - #installing...........................
ruby-2.4.1 - #making binaries executable..
ruby-2.4.1 - #downloading rubygems-2.7.8
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 899k 100 899k 0 0 2972k 0 --:--:-- --:--:-- --:--:-- 2977k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.4.1 - #extracting rubygems-2.7.8.....................................................................................................................................................................
ruby-2.4.1 - #removing old rubygems........
$LANG was empty, setting up LANG=en_US.utf8, if it fails again try setting LANG to something sane and try again.
ruby-2.4.1 - #installing rubygems-2.7.8.....................................
ruby-2.4.1 - #gemset created /usr/local/rvm/gems/ruby-2.4.1@global
ruby-2.4.1 - #importing gemset /usr/local/rvm/gemsets/global.gems...................................................
ruby-2.4.1 - #generating global wrappers.......
ruby-2.4.1 - #gemset created /usr/local/rvm/gems/ruby-2.4.1
ruby-2.4.1 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.4.1 - #generating default wrappers.......
ruby-2.4.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.4.1 - #complete
Please be aware that you just installed a ruby that requires 1 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.5.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
Set default Ruby
After installation of ruby 2.4.1, we will set it up as default ruby version.
rvm use 2.4.1 --default
Using /usr/local/rvm/gems/ruby-2.4.1
Check Ruby Version
ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
Now you have successfully installed ruby 2.4.1.
If you have any issue using this tutorial please feel free to comment below.