Most tutorials will tell you that in order to install Ruby on Rails on a cPanel server or VPS with Centos, you simply run a yum installation of ruby. Or even running the cPanel script for installing it. The problem is, that you’ll then get an old version of it installed.

If you want to install the latest version of Ruby (At the time of this post that’s Ruby Version 2.2 and Rails Version 4.2) simply do the following:

First, login to your server or VPS with the root user.

Then, use the Ruby Version Manager to make sure you get the latest version installed:

gpg2 –keyserver hkp:// –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -L | bash -s stable
source /etc/profile.d/
rvm requirements
Now, install the RVM:

rvm install 2.2.3
Configure 2.2.2 to be the default Ruby version:

rvm use 2.2.3 –default
Now, install Rails:

gem install rails
Confirm Ruby and Rails are installed:

root@server [~]# ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
rails -v
Rails 4.2.6

That’s it, you’re good to go