Archive for the ‘Ruby and Rails’ Category

mod_ruby embeds the Ruby interpreter into the Apache web server, allowing Ruby CGI scripts to be executed natively. These scripts will start up much faster than without mod_ruby.

1) Install eRuby:

# wget http://www.modruby.net/archive/eruby-1.0.5.tar.gz
# tar -xzvf eruby-1.0.5.tar.gz
# cd eruby-1.0.5/
# ./configure.rb –with-charset=euc-jp –enable-shared
# make; make install

2) Install mod_ruby

i)Download latest mod_ruby tar file
# wget http://www.modruby.net/archive/mod_ruby-1.2.6.tar.gz
# tar -xzvf mod_ruby-1.2.6.tar.gz
# cd mod_ruby-1.2.6/
#  ./configure.rb –enable-eruby –with-apxs=/usr/local/apache/bin/apxs
# make; make install

ii)Edit apache configuration file ( httd.conf) and add following code

LoadModule ruby_module libexec/mod_ruby.so
ClearModuleList
AddModule mod_ruby.c
AddHandler cgi-script .rb
<IfModule mod_mime.c>

# for Ruby/eRuby
<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
# for Apache::ERubyRun
RubyRequire apache/eruby-run
# for development
# RubyRequire auto-reload
# for add library
#RubyAddPath /usr/local/lib/ruby
# exec *.rbx as ruby scripts.
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
# handle *.rhtml as eruby files.
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>
</IfModule>

iii) Restart apache service on server

Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language. It is intended to be used with an Agile development methodology that is used by web developers for rapid development.

There is an inbuilt script in cPanel to install ruby and rails.

Login to shell using root user then execute following commands.

[root@root ~]#/scripts/installruby

[root@root ~]#gem install rails

[root@root ~]#gem install mongrel

[root@root ~]# gem install fastthread

Ruby and Rails needs some port to be open in your firewall.

If you are using IPtables then execute following commands to open ports.

iptables -A INPUT -p tcp –dport 3000 -j ACCEPT

iptables -A INPUT -p tcp –dport 12001 -j ACCEPT

Save IPtables and restart it.

Then login to WHM to check whether RoR is installed or not.