Tuesday, January 12, 2010

Ruby on Rails Deployment With Open Source Technology.

What We Need ? and What We Recommended. Ingredient For Deployment Recipes.

Linux: CentOs 5x (Recommended).
Kernel 2.6.x Flavor of any linux, Ubuntu, Gentoo , Or OpenSolaris.

WebServer: Apache(Httpd) Or Nginx (Recommended Stable)

Database : Mysql (Recommended Stable)

ImageMagick: 6.5.8-10 (Recommended Use Latest Version)

Ruby : 1.9.1 (Recommended Latest and Stable)

RubyGems : 1.3.5 (Recommended Latest and Stable)

Rails: 2.3.x (Recommended Latest and Stable)

Web Proxy: Mod_rails, Phusion Passenger. (Recommended Stable)

Let Start on Box.

[root@localhost ~]#yum install httpd httpd-devel mysql-server mysql mysql-devel phpmyadmin php

[root@localhost home]# wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.5.6-10.tar.gz

[root@localhost home]# wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.5.6-10.tar.gz
--2010-01-12 14:06:16-- ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.5.6-10.tar.gz
=> `ImageMagick-6.5.6-10.tar.gz'
Resolving ftp.fifi.org... 64.81.30.201
Connecting to ftp.fifi.org|64.81.30.201|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/ImageMagick ... done.
==> SIZE ImageMagick-6.5.6-10.tar.gz ... 11097065
==> PASV ... done. ==> RETR ImageMagick-6.5.6-10.tar.gz ... done.
Length: 11097065 (11M)

100%[==================================================================================================================>] 11,097,065 110K/s in 1m 42s

2010-01-12 14:08:07 (107 KB/s) - `ImageMagick-6.5.6-10.tar.gz' saved [11097065]

tar -xzvf ImageMagick-6.5.6-10.tar.gz

[root@localhost home]# cd ImageMagick-6.5.6-10

[root@localhost ImageMagick-6.5.6-10]# ./configure

[root@localhost ImageMagick-6.5.6-10]# make && make install

Downlaod Ruby and Install.

[root@localhost ~]# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
--2010-01-12 13:28:00-- ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz
=> `ruby-1.9.1-p376.tar.gz.1'
Resolving ftp.ruby-lang.org... 221.186.184.68
Connecting to ftp.ruby-lang.org|221.186.184.68|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/ruby/1.9 ... done.
==> SIZE ruby-1.9.1-p376.tar.gz ... 9073007
==> PASV ... done. ==> RETR ruby-1.9.1-p376.tar.gz ... done.
Length: 9073007 (8.7M)

100%[==================================================================================================================>] 9,073,007 217K/s in 54s

2010-01-12 13:28:58 (163 KB/s) - `ruby-1.9.1-p376.tar.gz' saved [9073007]

[root@localhost ~]#tar -xzvf ruby-1.9.1-p376.tar.gz
[root@localhost ~]#cd ruby-1.9.1-p376
[root@localhost ruby-1.9.1-p376]# ./configure
[root@localhost ruby-1.9.1-p376]# make && make install
[root@localhost ruby-1.9.1-p376]# which ruby
/usr/local/bin/ruby
[root@localhost ruby-1.9.1-p376]# /usr/local/bin/ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]

Download and Install RubyGems

[root@localhost home]# wget http://rubyforge.org/frs/download.php/60719/rubygems-1.3.5.zip
--2010-01-12 14:21:38-- http://rubyforge.org/frs/download.php/60719/rubygems-1.3.5.zip
Resolving rubyforge.org... 205.234.109.19
Connecting to rubyforge.org|205.234.109.19|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.5.zip [following]
--2010-01-12 14:21:43-- http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.5.zip
Resolving files.rubyforge.vm.bytemark.co.uk... 80.68.94.54
Connecting to files.rubyforge.vm.bytemark.co.uk|80.68.94.54|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 362863 (354K) [application/zip]
Saving to: `rubygems-1.3.5.zip'

100%[==================================================================================================================>] 362,863 34.6K/s in 15s

2010-01-12 14:22:02 (23.0 KB/s) - `rubygems-1.3.5.zip' saved [362863/362863]

[root@localhost home]# unzip rubygems-1.3.5.zip

[root@localhost home]# cd rubygems-1.3.5

[root@localhost rubygems-1.3.5]# /usr/local/bin/ruby setup.rb
RubyGems 1.3.5 installed

[root@localhost rubygems-1.3.5]# gem -v
1.3.5

[root@localhost rubygems-1.3.5]# gem -v
1.3.5
You have new mail in /var/spool/mail/root
[root@localhost rubygems-1.3.5]# gem install rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Updating class cache with 1513 classes...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...
You have new mail in /var/spool/mail/root
[root@localhost rubygems-1.3.5]# gem list rails

*** LOCAL GEMS ***

rails (2.3.5)

Download and Install Passenger

[root@localhost home]#gem install passenger
Building native extensions. This could take a while...
Building native extensions. This could take a while...
Successfully installed fastthread-1.0.7
Successfully installed passenger-2.2.9
2 gems installed
Installing ri documentation for fastthread-1.0.7...
Installing ri documentation for passenger-2.2.9...
Updating class cache with 2543 classes...
Installing RDoc documentation for fastthread-1.0.7...
Installing RDoc documentation for passenger-2.2.9...

[root@localhost rubygems-1.3.5]# passenger-install-apache2-module

-------------------------------------------

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.9
PassengerRuby /usr/local/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
----------------------------------------------

Edit Your httpd.conf and module.
Now Configure your Host in Apache Virtual Host and restart Apache.
/etc/init.d/httpd restart.

2 comments:

N Square said...

thanks for info. I was looking for same info. It is really helpful who wants to know about deployment.

sujit said...

wow great info.. keep it up