Tuesday , 24 January 2017
Home » Cpanel/WHM » Install Ruby on Rails in cPanel/WHM

Install Ruby on Rails in cPanel/WHM

The installation of Ruby on Rails in cPanel has two parts, first is installing Ruby itself, which can be accomplished by running:

/scripts/installruby

This script will install Ruby, RubyGems, Mongrel and the software that Ruby relies upon and activates the Ruby interface in your end user’s cPanel.

The second step in the installation is running.

/usr/local/cpanel/bin/ror_setup

This script will setup Ruby on Rails so that it will be activated when your system starts.
Ruby runs a separate server other than Apache for serving Ruby on Rails web applications, so setup for this requires a little more work. First you will need to login to your cPanel and click on the Ruby on Rails icon, to bring up the Ruby on Rails management interface that allows you to setup your Ruby environments. At this point, you will need to give your application a name and setup its path.

Note: If you set this path inside of your public_html directory your application’s source code and configuration files can be viewable by anyone on the web.

If you pay close attention to the URL used for the application, you will see that it has a number like :12001 at the end of it. This is because Ruby on Rails does not use the standard Apache web server, but rather uses its own, called Mongrel.

We can change these to be user-friendly. You will need to create a new subdomain or addon domain in cPanel, then click on the create rewrite button next to the Rails application name in cPanel, select the desired domain name from the drop down box, and now, whenever you go to this domain, it will display the RoR application

You will need to ensure
that ports 12001 and up are open (we recommend making the max number of the open ports 12001 plus whatever the number of Ruby applications you expect to be running will be).

Sometimes the gems repos will go down. If this happens during the installation, you will need to re-run /scripts/installruby.

About admin

I have been working with Linux based systems since 2002. I hope the article published on this site will be useful to those new to server administration.