To install ruby on a cPanel machine, the quickest way is to SSH to the machine, start a screen session, and run the installruby script.

screen -S rubyinstall
/scripts/installruby

Once that completes, you’re done! Sometimes, though, after everything is up and running smoothly you may encounter a problem where you try to add or start new ruby applications. If you can click the button and it says everything started fine, but the application doesn’t start, then check the cPanel error log. The easiest way is just to run the command below, while attempting to start the app through cPanel:

#tail -f /usr/local/cpanel/logs/error_log
/usr/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:109:in `load': uninitialized constant Gem::SourceIndex (NameError)
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:278
from /usr/bin/mongrel_rails:23:in `load'
from /usr/bin/mongrel_rails:23

If you’re seeing that error it likely means that rubygems was updated to a newer version than cPanel supports. You can check your version by running this command:

# gem -v

If the output is newer thanĀ 1.8.25, then that is definitely your problems. 1.8.25 is the newest version of rubygems that cPanel can support as of cPanel version 11.42. To downgrade you can run the commands below.

First, downgrade you rubygems version to the specific version of 1.8.25:

gem update --system 1.8.25

Second, uninstall all rubygems that aren’t of that version:

gem uninstall rubygems-update --version '> 1.8.25'

Then try starting or adding your rubyapp again. You shouldn’t encounter any problems anymore.