Ruby on Rails with Mongrel Clusters Connecting to Oracle Database

Note:
First disable selinux.
to check the config edit "/etc/sysconfig/selinux", if you made changes reboot the system.

Install the dependencies:

Development Libraries:
$ yum -v groupinstall "Development Libraries"
$ yum -v groupinstall "Development Tools"

Zlib:
$ yum install zlib zlib-devel

Readline:
$ yum install readline-devel

Freeimage:
$ wget http://nchc.dl.sourceforge.net/sourceforge/freeimage/FreeImage3120.zip
$ unzip FreeImage3120.zip
$ make
$ make install

1. Download and install Ruby 1.8.6 patch 111

Ruby download site : http://www.ruby-lang.org/en/downloads/

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz
$ tar xzvf ruby-1.8.6-p111.tar.gz
$ cd ruby-1.8.6-p111
$ ./configure
$ make
$ make install

Try checking the version if the installation goes well

$ ruby -v

Output:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]

2. Download and install Gem 1.0.1

$ wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz
$ tar xzvf rubygems-1.0.1.tgz
$ cd rubygems-1.0.1
$ ruby setup.rb

Do a version check again
$ gem -v

Output:
1.0.1

Install Rails 2.0.2 using the following command:

$ gem install rails -v 2.0.2 - (this would take time to install, in my test pc PentIII it took more than 2hrs)

3. Register to Oracle and download the following Oracle clients:

oracle-instantclient-basic-10.2.0.3-1.i386.rpm
oracle-instantclient-basic-10.2.0.3-1.i386.rpm
oracle-instantclient-sqlplus-10.2.0.3-1.i386.rpm

$ rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm
$ rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm
$ rpm -ivh oracle-instantclient-sqlplus-10.2.0.3-1.i386.rpm

* run and add this in the /etc/profile

$ LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib
$ export LD_LIBRARY_PATH

5. Download and install Ruby-OCI8

Download from http://rubyforge.org/frs/download.php/28396/ruby-oci8-1.0.0.tar.gz
Uncompress and extract the file contents.
Execute the following from within the extracted directory:

ruby setup.rb

* (Rails installation has to be finished before this) Copy the Oracle Adapter to the correct directory:

cp /path/to/oracle_adapter.rb /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/ (directory might be different on different installations, just search for active_record/connection_adapters)

6. Install other Ruby gems:

$ gem install mongrel
$ gem install mongrel_cluster
$ gem install ruby-debug
$ gem install soap4r -v 1.5.7
$ gem install image_science

7. Install apache using yum.

$ yum install httpd

* Configure Apache. Your httpd.conf needs a configuration like that of below:

<Proxy balancer://test>
BalancerMember http://127.0.0.1:3000
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
</Proxy>
<VirtualHost *:80>
ServerAdmin testaccount@gmail.com
ServerName test.com
ServerAlias test
ProxyPass / balancer://test/
ProxyPassReverse / balancer://test/
ErrorLog /var/log/apache_error_log
CustomLog /var/log/apache_access_log combined
</VirtualHost>

* replace test and testaccount base on your server details

Comments

Popular posts from this blog

Radiator Radius Installation connecting to ORACLE (CentOS)

Scraping an Entire Website using LINUX

How to enable clustering in Openfire Enterprise?