Help - Search - Members - Calendar
Full Version: How To: Ruby 1.8.5 with Ensim 4+ and RHEL4
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
AdamS
Updated for latest version 1.8.7.
Now with Enterprise Linux 5 packages


Ruby 1.8.7-p72 for RHEL4 on an x86 machine.
mod_ruby and eRuby modules built with Apache2.

This quick how to will explain how to install ruby, eruby, mod_ruby with Ensim. These RPMs will work on plain RHEL4 servers without Ensim.

Please note I am not responsible if you break your server because of this how to. Use this information at your own risk. These RPM packages work great on all my boxes.

To install rpm, simply run rpm -ivh file.rpm file2.rpm
Example:

CODE
rpm -ivh ruby-1.8.7.72-1.el4.i386.rpm ruby-libs-1.8.7.72-1.el4.i386.rpm ruby-abi-1.8.7.72-1.el4.i386.rpm


If upgrading, use -Uvh arguments instead.

All rpms are available at:

Enterprise Linux 4:

http://www.amsdi.com/downloads/linux/redhat/el4/ruby

Enterprise Linux 5:

http://www.amsdi.com/downloads/linux/redhat/el5/ruby


Ruby requires: ruby, ruby-libs, ruby-abi
eRuby requires: eruby eruby-libs mod_ruby


Ensim customizations:

Add ruby to each virtual site, do the following:

Edit or create /etc/virtualhosting/filelists/siteinfo.custom.sh

CODE
#!/bin/bash

read
while [ $? == 0 ]; do
        echo $REPLY
        read
done

echo "N:S,rpm:ruby"
echo "N:S,rpm:ruby-libs"
echo "N:S,rpm:ruby-abi"
echo "N:S,rpm:eruby"
echo "N:S,rpm:eruby-libs"


Run the following in the terminal:

For Ensim 4
CODE
set_pre_maintenance
set_maintenance
set_post_maintenance


For Ensim X
CODE
/usr/local/sbin/synchronizeFST -S


Then run (Ensim 4 Only):
service webppliance restart

To use mod_ruby, you must edit /etc/httpd/conf.d/ruby.conf

My configuration looks like this:
CODE
LoadModule ruby_module modules/mod_ruby.so

# This will allow execution of mod_perl to compile your scripts to
# subroutines which it will execute directly, avoiding the costly
# compile process for most requests.

RubyRequire apache/ruby-run
Alias /ruby /var/www/ruby

# Execute *.rbx files as Ruby scripts
#
<Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
</Files>

# Handle *.rhtml as eruby files
#  
<Files *.rhtml>
    RubyRequire  apache/eruby-run
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
</Files>


Restart apache

CODE
/etc/rc.d/init.d/httpd restart


For ruby on rails, see this post: http://forums.theplanet.com/index.php?show...st&p=568044

Enjoy!
UH-Matt
Great work so far, replying to subscribe for updates.

Does this create a lot of additional resource on an Ensim server when enabled for all sites, or have you not got that far yet? icon_smile.gif
AdamS
Have not noticed any changes in load thus far. Only have one site really using the language at the moment. Will keep you updated.
xUx
Good job! I'll stick here for the update icon_biggrin.gif
AdamS
Rails framework in virtual site.

* Tested with 3.1 compatibility site

The following RPMs need to be installed:
ruby-gems-1.3.1-1.el4.i386.rpm
rubygem-actionmailer-2.2.2-1.el4.noarch.rpm
rubygem-actionpack-2.2.2-1.el4.noarch.rpm
rubygem-actionwebservice-1.2.6-1.el4.noarch.rpm
rubygem-activerecord-2.2.2-1.el4.noarch.rpm
rubygem-activeresource-2.2.2-1.el4.noarch.rpm
rubygem-activesupport-2.2.2-1.el4.noarch.rpm
rubygem-rails-2.2.2-1.el4.noarch.rpm
rubygem-rake-0.8.3-1.el4.noarch.rpm


Make sure mysql is enabled for site
Login to siteadmin, set mysql password, create mysql database

In shell as root:

CODE
cd /home/virtual/site#/fst/var/www
mv html html.save
rails railsapp
chown -R admin#:admin# railsapp
ln -s railsapp/public html


Edit railsapp/config/database.yml

CODE
development:
  adapter: mysql
  database: yourdatabase
  username: dbuser
  password: dbpass
  socket: /var/lib/mysql.sock

production:
  adapter: mysql
  database: yourdatabase
  username: dbuser
  password: dbpass
  socket: /var/lib/mysql.sock


Now, the real test:

CODE
cd public
rm -f index.html
cd ..
script/generate controller home index


If no error messages, test it: http://testdomain.com/home/index


Working on FastCGI support, I will update when I get it all working.

If you would like ruby scripts to run in FastCGI (not in the rails framework)

Install FCGI stuff for ruby using gem app (no RPM as of yet):

CODE
gem install fcgi


In /etc/httpd/conf/httpd.conf

Enable fastcgi module:

CODE
LoadModule fastcgi_module modules/mod_fastcgi.so


Somewhere add the following:

CODE
<IfModule mod_fastcgi.c>
        AddHandler fastcgi-script .fcgi
</IfModule>
AdamS
Version 1.8.6 now available for download. Follow link in first post.
mta
QUOTE (AdamS @ Apr 26 2007, 11:28 PM) *
Version 1.8.6 now available for download. Follow link in first post.


Would you mind posting the SRPMS as well, or at least the .specs ?

Thanks!

-Michael
mta
QUOTE (mta @ Jun 1 2007, 08:59 PM) *
Would you mind posting the SRPMS as well, or at least the .specs ?

Thanks!

-Michael


I built our own ruby and ruby-mysql RPMs from the SRPMs at
http://dev.centos.org/centos/4/testing/SRPMS/. Had to fix the ruby-rubyprefix.patch for 1.8.6 and slightly modify the .spec ( remove %files reference to missing file NEWS ), but aside from that, worked great.

As for rubygems, gem2spec, and ruby-abi, I found good .spec files at http://people.redhat.com/dlutter/yum/spec/.

If anyone's wondering why I went through all this trouble, when it comes to custom-built packages I prefer to be able to build/update them myself. Also, the rubygems and gem pacakges provided on Adam's site were a bit older than what I needed.

Hope this info helps someone out.

- Michael A.
AdamS
Sorry man, been busy, guess you don't need my specs now. icon_smile.gif

Glad you figured it out!
skywalllker
Thanks for the guide. Instead of enabling Ruby on every virtual account via /etc/virtualhosting/filelists/siteinfo.custom.sh, can I enable this on a single / specific virtual account only? If possible, how can it be done?

Thank you :-)
janebush08
Thank you for guidance... great help found here...
AdamS
QUOTE (skywalllker @ Jul 19 2008, 12:46 AM) *
Thanks for the guide. Instead of enabling Ruby on every virtual account via /etc/virtualhosting/filelists/siteinfo.custom.sh, can I enable this on a single / specific virtual account only? If possible, how can it be done?

Thank you :-)


Assuming your site domain.com has the id of site1, go to the /etc/httpd/conf/site1 directory create a file called ruby or whatever you want and add

CODE
# Execute *.rbx files as Ruby scripts
#
<Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
</Files>

# Handle *.rhtml as eruby files
#  
<Files *.rhtml>
    RubyRequire  apache/eruby-run
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
</Files>


Then your /etc/httpd/conf.d/ruby.conf should only now contain:

CODE
LoadModule ruby_module modules/mod_ruby.so

# This will allow execution of mod_perl to compile your scripts to
# subroutines which it will execute directly, avoiding the costly
# compile process for most requests.

RubyRequire apache/ruby-run


As far as the file lists for the ruby RPMS, if you want it per site just either copy the ruby binary and libs manually to the site or you can use that EnsimPKG script floating around here or extract the rpm to the site's chroot. So many different ways. If the site is 3.1 mode they wouldn't even need the binaries, it will work fine through apache either way. That setup is for High security sites and for users to run binary scripts in the console.

QUOTE (janebush08 @ Nov 7 2008, 06:42 AM) *
Thank you for guidance... great help found here...


No problem. Keep an eye on the thread Ill have the latest for EL4 and EL5 in the next week or so.
dalma
Just checking in to see if there are any packages for RHEL5 and Ensim 10.3. I am debating on trying the Phusion Passenger install but not sure.

Thanks
AdamS
QUOTE (dalma @ Dec 16 2008, 06:55 PM) *
Just checking in to see if there are any packages for RHEL5 and Ensim 10.3. I am debating on trying the Phusion Passenger install but not sure.

Thanks


I'll release the el5 ones when I build with the latest. Just been very busy lately. Sorry all.
Catalyst
I built RPM's for all of those for a paying customer ... so that they were easily integratable into Ensim ... but I'm a little loathe to point people at them, considering they were paid ... but, uhh ... I might ask ... Some of them were an absolute pain because several of the "newer" versions don't work with the Yum-available Ruby packages.
AdamS
Latest 1.8.7 p72 RPMS for el4 now available.

ruby-gems updated to latest.

Gems updated to latest and are now packaged as rubygem-(gemname) rather than ruby-gems-(gemname). Remove old gem packages first


CODE
rpm -e ruby-gems-activerecord ruby-gems-rake ruby-gems-rails ruby-gems-activesupport \
ruby-gems-actionwebservice ruby-gems-actionmailer ruby-gems-actionpack


New rails dependency: rubygem-activeresource

QUOTE (Catalyst @ Jan 5 2009, 04:04 PM) *
I built RPM's for all of those for a paying customer ... so that they were easily integratable into Ensim ... but I'm a little loathe to point people at them, considering they were paid ... but, uhh ... I might ask ... Some of them were an absolute pain because several of the "newer" versions don't work with the Yum-available Ruby packages.


What problems were you having? What repo were you using? I had some problems getting my SPECS to build be did get around it.
AdamS
Added EL5 packages. See in first post.
AlexFomichev
Good day, AdamS.
Can you please update ruby 1.8.7 rpm or can you publish the SRPM/spec also so we can update it by self?
Thank you in advance, and i appreciate your good work!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.