Install Ruby 2.3.1 or any other version on Centos

1. Installing Recommended Packages

There are few developemnt libraries required to run Ruby on Linux. Use following command to install recommended packages on your server using yum.


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

2. Install RVM ( Ruby Version Manager )
Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.
# curl -L | bash -s stable
3. Setup RVM Environment
After installing RVM first we need to setup rvm environment using below command.
# source /etc/profile.d/
4. Install Required Ruby Version
RVM provides option to manage multiple ruby version on single system. Use following command to install required version of Ruby.
# rvm install 1.9.3   

5.  Install Another Version

# rvm install 2.3.1
6. Setup Default Ruby Version

# rvm use 2.3.1 –default
Using /usr/local/rvm/gems/ruby-2.3.1

7. Check Current Ruby Version

# ruby –version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]



That’s all folks.