Installing Rails and Mongrel on Ubuntu

Published: 27 Jan 2007

So you have ruby installed and now you want to start putting together some web applications. There are several options when it comes to what web server you actually run your app on. More on that in a bit. First let's install Rails on Ubuntu:

gem install rails --include-dependencies

OK! you're kidding. Now verify the install with:

rails -v

you should get the following as a response:

Rails 1.2.1

Now, back to what web server(s) you have the option of running your app on. In my reading about the options recently, I came across an interesting post, "Scaling Rails with Apache 2.2, mod_proxy_balancer and Mongrel" about scaling a Rails app on FreeBSD.

Since I know I'm going to be running a version of Apache I'm gonna go ahead and install Mongrel for now and worry about proxying Mongrel through Apache later. So far, this is a personal decision just based on the little bit of research I've done about the options and I will probably do some more due diligence by investigating the best environment for my needs when it gets closer to production time. Other options are the built-in web server (WEBrick) that comes with Rails or lighttpd which is a separate install.

The steps for installing Mongrel are almost as easy as the Rails install. Again, assuming you have Ruby (version 1.8.4 and above) and Ruby gems installed just do the following:

sudu gem install mongrel

That's it. You can verify the install by changing to your Rails application directory and enter the following:

mongrel_rails start -d

This should start Mongrel on port 3000.