Ruby, Ruby Gems, Rails and FastCGI Installation

Posted by Miraenda Sun, 04 Jun 2006 04:34:00 GMT

A. Install Ruby (latest source package - http://ruby-lang.org/en/20020102.html):
mkdir /root/setup
cd /root/setup && wget ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
tar -xvzf ruby-*
cd ruby-*
./configure && make && make install

B. Install Ruby Gems (latest version - http://rubyforge.org/frs/?group_id=126):
cd /root/setup && wget rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar -xvzf rubygems-*
cd rubygems-*
ruby setup.rb

C. Install Rails:
gem install rails

(Answer y to all the dependancies)

D. Install FCGI and FastCGI (sourced from http://fastcgi.com/dist/):
cd /root/setup && wget fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xvzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure && make && make install

cd /root/setup && wget fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
tar -xvzf mod_fastcgi-*
cd mod_fastcgi-*
/usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so

E. Install Ruby Gems fcgi:
gem install fcgi

F. Edit Apache config file:
vi /etc/httpd/conf/httpd.conf

Find the following (usually I do esc + / and enter SSLL to find this area in httpd.conf file):

SSLLog      /usr/local/apache/logs/ssl_engine_log
SSLLogLevel info

</IfModule>

Enter these lines under the ending </IfModule> line:

<IfModule mod_fastcgi.c>
    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi
</IfModule>

Check for the fastcgi apache module entries:
LoadModule fastcgi_module libexec/mod_fastcgi.so
and
AddModule mod_fastcgi.c

G. Make the /tmp/fcgi_ipc/ directory and setup Apache permissions for it:
mkdir -p /tmp/fcgi_ipc
chown nobody:nobody /tmp/fcgi_ipc -R
chmod -755 /tmp/fcgi_ipc -R

H. Install MySQL for Ruby:
gem install mysql

Select option 3 for the installation process.

I. Install PostGRESQL for Ruby (if you have PostGRESQL on your cPanel Dedicated server):
gem install postgres

J. Restart Apache:
/etc/init.d/httpd stop
killall -9 httpd
/etc/init.d/httpd startssl

K. Additional Information:

Please note that user and appname should be replaced by the specific account's cPanel username and the application folder name you want to use for your Rails' application.

a. Make sure Apache can find dispatch.fcgi

Edit your Rails application’s /home/user/appname/public/.htaccess and change the following lines to make sure that the Rails app is using FastCGI.

Change:
RewriteRule ^(.*)$ dispatch.cgi?$1 [QSA,L]
to
RewriteRule ^(.*)$ dispatch.fcgi?$1 [QSA,L]

b. Make sure that dispatch.fcgi is executable
chmod 755 /home/user/appname/public/dispatch.fcgi

c. For existing applications:

Make sure that your app lives in /home/user/appname. Add the following lines in your Rails application’s /home/user/appname/public/dispatch.fcgi file:
require 'fcgi'
require 'rubygems'
require_gem 'fcgi'

d. For a new account, you can test Rails doing the following:
cd /home/user
rails appname
cd appname
ruby script/generate controller test
cd /home/user/public_html
ln -s ../appname/public appname

Navigate to http://domain.com/appname/ and you should see a “Congratulations” page!

Posted in  | 32 comments | no trackbacks

Comments

  1. dschlenker said 417 days later:
    new stable version of Ruby, 1.8.5: ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
  2. , said 643 days later:
    n,
  3. , said 643 days later:
    hh
  4. m said 643 days later:
    .
  5. 88888888888 said 643 days later:
    cccbvcv
  6. prom dresses said 1444 days later:
    Good post.
  7. cheap jordans said 1479 days later:
    Thanks for the great post. It reminds me that I have to bring more structure in to my blogging. Your blog is very interesting. Please let me know how to go for your rss blog.
  8. China wedding dress said 1481 days later:
    http://www.casual-mall.com http://www.mycasualmall.com http://www.holydress.com http://www.fuzhou-traffic.com http://www.brands-center.com
  9. Bvlgari jewelry said 1485 days later:
    Thanks for a great time visiting your site. It's really a pleasure knowing a site like this packed with great information.
  10. cheap jordans said 1487 days later:
    Cool comments. Big thanks for all visitors and for author. I love this site!!!
  11. coach bag said 1488 days later:
    Thanks for a great time visiting your site. It's really a pleasure knowing a site like this packed with great information.
  12. fuel saver said 1495 days later:
    Thank you for the info, it really helps.
  13. Gucci Shoes said 1500 days later:
    Nice job, it’s a great post. The info is good to know!
  14. Coach outlet said 1502 days later:
    Thanks for a great time visiting your site. It's really a pleasure knowing a site like this packed with great information.
  15. louis vuitton bags said 1502 days later:
    cheap lv handbags on sale
  16. Chanel 2.55 handbags said 1502 days later:
    Chanel 2.55 handbags
  17. Supra Shoes said 1502 days later:
    Supra Shoes
  18. cheap UGG Boots outlet said 1502 days later:
    cheap UGG Boots outlet
  19. MBT Sneaker,Anti Shoes said 1502 days later:
    MBT Sneaker,Anti Shoes
  20. cheap jersey said 1513 days later:
    thanks… I’ve been bookmarking them for a while now and just decided to create a post to provide them to others…
  21. replica watches said 1514 days later:
    http://www.rep1ica.com/GoodsBrand/Corum-35.html http://www.rep1ica.com/GoodsBrand/Daniel-Roth-36.html http://www.rep1ica.com/GoodsBrand/Ebel-37.html http://www.rep1ica.com/GoodsBrand/Franck-Muller-38.html http://www.rep1ica.com/GoodsBrand/Gerald-Genta-39.html
  22. may said 1523 days later:
    Thanks for the great post. It reminds me that I have to bring more structure in to my blogging. Your blog is very interesting. Please let me know how to go for your rss blog. http://www.blogigo.com/Dress_Clothing_Blog
  23. wholesale hats said 1529 days later:
    Perhaps this is one of the most interesting blogs that I have ever seen. Interesting article, Funny comment. Keep it up!
  24. Red Bull Hats said 1529 days later:
    Fantastic Read! Looking forward to more! Bookmarked the site and will be back again!
  25. amethyst rings said 1530 days later:
    You have got some great posts in your blog. Keep up with the good work.
  26. gemstone pendant said 1530 days later:
    This is a great post; it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it
  27. pandora jewelry said 1536 days later:
    it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it
  28. i68 quad band said 1538 days later:
    Thank you for sharing
  29. i9 quad band phone said 1538 days later:
    I really want learn it better.
  30. may said 1541 days later:
    This article is very good, thank you for sharing! http://dressclothingblog.blog.com/ http://mickeyli.vox.com/
  31. replica watches said 1547 days later:
    This article is really great, strong support Rolex Submariner http://www.topluxwatch.com/
  32. Neu Eingetroffen said 1550 days later:
    Thank you ,it's really useful.

Trackbacks

Use the following link to trackback from your own site:
http://rubyasylum.com/articles/trackback/7

(leave url/email »)

   Preview comment