RPMs for Deploying Rails on CentOS
Thanks to mongrel, Ruby on Rails deployment is finally decent. Several weeks back I switched all of our servers over to using Apache 2.2 with mod_proxy_balancer, mongrel and mongrel_cluster, and I haven’t had any problems.
Unfortunately, since most of our servers run CentOS (repackaged RedHat Enterprise Server 4), the setup isn’t as easy as it could be since it ships with Apache 2.0 and ruby 1.8.2, which doesn’t work with Rails. So I’ve rebuilt all the necessary RPMs (and more) and made them available to make deploying a snap. Note: these packages should also work on RedHat Enterprise Linux 4, however, I have not tested them.
Yum configuration
Download or create the yum config in /etc/yum.repos.d/ file with the following contents:
[ci] name=[i] Collective Idea RPM Repository baseurl=http://source.collectiveidea.com/pub/linux/centos/4/i386 gpgcheck=1 enabled=1 gpgkey=http://source.collectiveidea.com/pub//RPM-GPG-KEY
Install Packages
To install the packages, run:
yum install httpd ruby ruby-devel rubygems ri
Note: If you already have Apache and other modules installed, this command may fail. You can try running yum upgrade, or you may just need to remove the packages before you install the new packages. If you’re using any packages, such as other Apache modules, that I haven’t rebuilt against Apache 2.2, let me know and I can add them.
Install Gems
Install the gems you need by running:
gem install -y rails mongrel mongrel_cluster
Configure Apache and Mongrel
Lastly, follow one of the guides for configuring Apache and mongrel.
Let me know if you have any problems with these packages.
21 Comments
I’ve tried to install your httpd package on our CentOS box (in order to get mod_proxy_balancer so I can use mongrel_cluster), but we end up with three errors (we already have httpd 2.0.52-22.ent.centos4 installed):
Error: Missing Dependency: httpd-mmn = 20020903 is needed by package php
Error: Missing Dependency: libaprutil-0.so.0 is needed by package subversion
Error: Missing Dependency: libapr-0.so.0 is needed by package subversion
Any idea what may cause this?
You need to install php and subversion from our repository, They’ve been rebuilt against the new versions of apache. If you added the yum configuration, you should just be able to do:
If that fails, your best bet may just be to remove the old versions of apache, php and subversion, then try to install the new ones.
Thank for the easy upgrade help.
One problem is that I am getting a similar error for mod_perl on a clean Centos 4.3 test box.
Error: Missing Dependency: httpd-mmn = 20020903 is needed by package mod_perl
Error: Missing Dependency: libaprutil-0.so.0 is needed by package mod_perl
Error: Missing Dependency: libapr-0.so.0 is needed by package mod_perl
I removed mod_perl with yum and the install/update goes fine. This is o.k. since mp in Centos 4.3 is 1.99_16-4 and would be removed/updated anyway.
Yeah, any Apache modules need to be rebuilt. I don’t use mod_perl, so I hadn’t rebuilt it yet. But I will get it rebuilt and put it in the repository if you want it.
Hi,
thanks for the repo!
I need add libcurl to php, do I’ve to use your the php5.src.rpm and recompile, right?
Can you give me some advice, thks
Thanks for the donation of time and resources to the community.
Everything has worked fine except when I get to using gem. I enter the following command:
gem install -y rails mongrel mongrel_cluster
And it fails with:
/usr/bin/gem:3:in `require’: no such file to load — rubygems (LoadError)
from /usr/bin/gem:3
What I noticed then was two Ruby library paths:
/usr/lib/ruby/1.8
/usr/local/lib/ruby/1.8
It appears to be searching in /usr/local/lib/ruby/1.8 where rubygems isn’t. So, to rectify this I ran:
export RUBYLIB=/usr/lib/ruby/1.8
This settles the first error, but RUBYLIB needs to be permanently set this way (/etc/bashrc ??). And afterwards I am left with this:
Attempting local installation of ‘rails’
Local gem file not found: rails*.gem
Attempting remote installation of ‘rails’
/usr/lib/ruby/1.8/rubygems.rb:204:in `report_activate_error’: Could not find RubyGem sources (> 0.0.0) (Gem::LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:141:in `activate’
from /usr/lib/ruby/1.8/rubygems.rb:37:in `require_gem_with_options’
from /usr/lib/ruby/1.8/rubygems.rb:31:in `require_gem’
from /usr/lib/ruby/1.8/rubygems/remote_installer.rb:425:in `sources’
from /usr/lib/ruby/1.8/rubygems/remote_installer.rb:435:in `source_index_hash’
from /usr/lib/ruby/1.8/rubygems/remote_installer.rb:399:in `install’
from /usr/lib/ruby/1.8/rubygems/gem_commands.rb:195:in `execute’
from /usr/lib/ruby/1.8/rubygems/gem_commands.rb:153:in `each’
from /usr/lib/ruby/1.8/rubygems/gem_commands.rb:153:in `execute’
from /usr/lib/ruby/1.8/rubygems/command.rb:49:in `invoke’
from /usr/lib/ruby/1.8/rubygems/cmd_manager.rb:94:in `process_args’
from /usr/lib/ruby/1.8/rubygems/cmd_manager.rb:67:in `run’
from /usr/lib/ruby/1.8/rubygems/gem_runner.rb:13:in `run’
from /usr/bin/gem:17
This was a whopper, but I finally found the solution here:
http://geoffreyarnold.com/index.php/wiki/changeblog
You need to manually install the sources gem:
gem install /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem
Then gem seems to work great!
hmm, did you have your own version of Ruby and/or rubygems in your path that was overridding the RPMs?
I don’t think so, but it I’m not certain. I did try a complete removal of ruby, ri, rubygems, rdoc, etc then reinstalling from your repos, but still had the same failure.
[…] I’ve built RPMs for deploying Apache 2.2 + Mongrel on x86_64 CentOS. Download the yum config to /etc/yum.repos.d/. Check out the post about the 32bit RPMS for more information. […]
Brandon,
I am getting a 404 error on the “/headers/header.info” that yum tries to access — has this repository stopped being available? Please check, and update if needed.
Thanks,
Dennis
Dennis,
It sounds like you’re using an old version of yum. As far as I know, yum doesn’t use the headers/header.info file any more. Try doing “yum update yum” first.
Brandon
Brandon,
Mongrel won’t startup on my CentOS 4.3 slicehost slice. Ideas? Looks like I’m not the only one:
http://rubyforge.org/forum/forum.php?thread_id=9188&forum_id=5450
Here’s the error:
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:38: uninitialized constant Mongrel::HttpHandler (NameError)
from /usr/lib64/ruby/1.8/rubygems/custom_require.rb:21:in `require’
from /usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:10
from /usr/bin/mongrel_rails:18
I figured out my issue. GCC and make weren’t installed.
yum install make gcc
Then reinstall mongrel
gem install -y mongrel mongrel_cluster
If you are having trouble getting the correct php to install, try ‘yum —disablerepo=* —enablerepo=ci install php’
Hi guys,
I have a little problem, when trying to do a ‘yum install —disablerepo=* —enablerepo=ci httpd’ i get the following
error ‘Error: Missing Dependency: gcc = 3.4.5 is needed by package apr-devel’ but a ‘rpm -qa | grep gcc’ gives the following results ‘gcc-3.4.6-3’
‘libgcc-3.4.6-3’
‘gcc-c++-3.4.6-3’
Can someone please help me on this issue? the Centos that i am using is 4.4.
Thanks
Vlad Mihai: Do you by chance have a version of apr-devel already installed?
I have used these for several months and so far it’s working great.
One question.
Is it possible to get the sript/console from these rpms?
script/console comes from Rails, do you mean irb?
none of the four links your provided for configuring Apache and mongrel works.
Hi – We have several dozen servers we deployed this solution on approx 18 months ago. Now, however, we encounter errors when building new servers. The repo http://source.collectiveidea.com/pub/linux/centos/4/i386 has disappeared.
Is there a replacement repo to be found somewhere?
Post a Comment