Install Mongrel on Ubuntu 6.06 Dapper

written September 13 2006 by
Kommen
tagged with
, , , ,
13 Comments so far. Go, post one!
Previous RadRails 0.7.1 released
Parse natural language… Next
Migrations in Ruby on Rails
Exception Notifier - Ruby on Rails plugin
State of Web Development 2006
Parse natural language date/time strings in Ruby with Chronic

As I mentioned in my last post, RadRails 0.7.1 now supports Mongrel. So I decided to use Mongrel instead of Webrick for development on my notebook. But it was a bit tricky and took me a bit of googling to get it.

As Joe wrote in his post about installing Mongrel on MacOS X, I’ll describe how to install it on Ubuntu, assuming you already have Ruby and Ruby on Rails up and running.

Because Mongrel is partly written in C/C++ for more performance, you have to install the build-essential package. It will install all needed packages so that you can compile C/C++ applications.

sudo apt-get install build-essential
(You can also use the synaptic package manager to install it, if you prefer a GUI)

You also need the @ ruby1.8-dev@ package. When you try to install Mongrel without this installed, it will complain with this errormessage:
extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:1

Install the package with this command:
sudo apt-get install ruby1.8-dev

Then just use gem to install Mongrel:
sudo gem install mongrel —include-dependencies

Gem will ask you, which version of Mongrel you want to install. Choose the latest ruby verion.
Then you’ll see some output from the C/C++ compiler.


Ok, you’re done! Now you can start the server with mongrel_rails in your Railsapp directory.

NOTE: Even without the build-essential package installed, Mongrel will install and say that installation was successful. But when you try to start the server, you’ll get an error message like this:
** Starting Mongrel listening at 0.0.0.0:3000
/usr/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3/lib/
mongrel.rb:666:in `register’: undefined method `resolve’ for
nil:Mongrel::URIClassifier (NoMethodError)

13 Comments

Make our day bright and participate!
Permalink to this comment { Kommen }
on September 20 2006 (about 11:45 AM)

UPDATE:
This tutorial also works with Ubuntu 6.10 Edgy Eft (tested with Knot 3)

I’ve added instructions to install the ruby1.8-dev package. This is also needed for installing Mongrel.

Permalink to this comment { LN }
on November 04 2006 (about 04:18 AM)

Hi Kommen,

I am newbie using Mongrel. We don’t need apache to run Mongrel?

Thanks,
ln

Permalink to this comment { Kommen }
on November 04 2006 (about 17:14 PM)

Hi,

no you don’t need Apache to use Mongrel. Mongrel is a standalone server. But most people use Mongrel and Apache (in production use) together:
Mongrel as the application server and Apache as the webserver.

For development, you won’t need Apache.

Permalink to this comment { LN }
on November 04 2006 (about 18:24 PM)

I found the answer on Mongrel website.

Thanks anyway.

ln

Permalink to this comment { Shef }
on January 08 2007 (about 09:19 AM)

Thanks for the tips, i had forgotten the ruby dev package, and it was driving me mad!

Permalink to this comment { Carl Anderson }
on May 13 2007 (about 08:07 AM)

Thanks, it worked on Feisty Fawn also.

Permalink to this comment { Alfonso Adriasola }
on June 07 2007 (about 07:50 AM)

thanks again, this works perfectly

Permalink to this comment { vish canaran }
on June 23 2007 (about 16:25 PM)

Thank you; I installed Ubuntu Feisty Fawn server and these steps did the trick not just for Mongrel but for sudo gem install mysql. Back to Ruby.

Thank you J&K

Vish

Permalink to this comment { Ben }
on August 31 2007 (about 14:47 PM)

On my machine, this worked but I needed to take it a couple steps further:
1. Go to the mongrel gem folder (/usr/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3 in this example) and run the setup.rb as root (sudo ruby setup.rb)
2. Add “#!/usr/bin/ruby1.8” to the top of the /usr/bin/mongrel_rails script if it doesn’t already exist. See http://www.forthecode.com/user/index/32 for more info.

Permalink to this comment { Tyler Montgomery }
on September 09 2007 (about 01:04 AM)

Thanks for this…I had no idea why monrel wouldn’t install worked great!

Permalink to this comment { Lucas Uyezu }
on January 01 2008 (about 21:36 PM)

Thanks guys, it saved me some trouble.

I’m starting a blog, and then I decided to post about this post.

If you don’t mind, I linked this post on my site: railslcones.com.

Permalink to this comment { ivnacho }
on December 10 2008 (about 19:02 PM)

sudo gem install mongrel

Building native extensions. This could take a while…
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install mongrel .include-dependencies
creating Makefile

make
cc -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c fastthread.c
fastthread.c: In function âwait_condvarâ:
fastthread.c:626: warning: passing argument 1 of ârb_ensureâ from incompatible pointer type
cc -shared -o fastthread.so fastthread.o -L"." -L"/usr/lib" -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8 -lpthread -ldl -lcrypt -lm -lc

make install
/usr/bin/install -c -m 0755 fastthread.so /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/lib
make: /usr/bin/install: Command not found
make: * [/usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/lib/fastthread.so] Error 127

Permalink to this comment { Martin }
on December 19 2008 (about 17:02 PM)

Thx 4 thread, it gave me the hint!

Do participate!

Textile (only links and basic formatting) is allowed.
These are not required