Canadian Web Hosting Blog and News
31Jan/080

Installing Ruby on Rails in Cpanel

cPanel 11 Stage 2 (currently in the most recent RELEASE build) have RoR functionality, including Rails and Gems options on cpanel.

Note: For RoR, Apache must have mod_proxy support.

How To Install Ruby on a cpanel Server

/scripts/installruby

How TO Install And Setup Gems

Ruby Gems are collections of functions that allow you to perform tasks in Ruby. You will need to install a Gem before you can use it inside a Ruby program.

Note: Current cpanel version has some bugs or issue with Gem Setup. We may sometimes need to configure Gems and Rails from command line.

Steps:

Install RubyGems:
----------------

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar xvzf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb all

This step involves execution of `ruby setup.rb` with arguments `config / setup / install` all together

gem query --local
OR
gem q -L

Listing all installed gems

Install Rails:
--------------

gem install rails OR # (Enter Y for all dependencies)
gem install rails --include-dependencies

Note: maximum memory a cPanel process can be used must be set to a value greater than 128M(WHM > Server Configuration -> Tweak Settings)

Location of Your Ruby Gem on Application(s)

Path: /home/username/ruby/gems

Using Your Ruby Gem(s)

You will need to add /home/username/ruby/gems to the include path. You can do this by adding the following code to your script:

$:.push("/home/username/ruby/gems")

Start And Stop Ruby Application

Once the setup is completed. You can start/stop the application using the Action button on cpanel

Set up a Redirection

The default port appears to be 12001, so the actual URL is: http://domain.com:12001/ ..which loads the app running at: /home/domain/path/to/rails/app/appname http://domain.com/Applnname to http://domain.com:12001/Applnname

You can set up this redirection using a .htaccess file inside the "Applnname" directory.

Here the complete installation process :

a) /scripts/installruby (unfortunately it is currently not perfect, no idea why)

b) gem install rails

c) gem install mongrel

if fastthread isn't installed (normally you will be asked for fastthread during mongrel installation)

d) gem install fastthread

Don't forget to open firewall ports 3000 and 12001

 

Kevin Liang
CTO / SEO Guru
Canadian Web Hosting
http://www.canadianwebhosting.com/

Related Posts:

  • No Related Posts
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.