To upgrade Ruby on CentOS, you can build and install Ruby from the source. If you already installed ruby and ruby-devel packages with yum before, remove them first before upgrading Ruby. Build and install the latest Ruby from the source as follows. Finally, update Rubygems and Bundler.