My Brain on Code

WEBrick Error on Ubuntu 9.04 (Jaunty)

Today I decided to do a clean install of ruby on rails on my Ubuntu laptop. I decided I would use the ruby packages in Ubuntu’s repositories. However, I ran into a few snags while getting my rails app to run. Here I document the trouble I ran into.

First, I needed to actually install Ruby. So I issued:

sudo apt-get install ruby

This installs ruby 1.8.7. Then I issued:

sudo apt-get install rubygems1.8

Now ruby gems 1.3.5 is installed (the package is called rubygems1.8 because ruby gems 1.3.5 targets ruby 1.8.x). Now to get rails up and running:

sudo gem install rails

Alrighty, time to fire up my rails app

$ ruby script/server
Rails 2.3.4 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)   
  
 /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:271:in require_frameworks: no   
such file to load -- net/https (RuntimeError) 
    /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb: 271: in  
require_frameworks: no such file to load - net / https (RuntimeError)

Uh oh! What’s that?! Hmmm…well here:

require_frameworks: no such file to load -- net/https (RuntimeError)

It looks like it has something to do with SSL. Searching “ruby ssl” on packages.ubuntu.com I find libopenssl-ruby1.8. So it looks like that’s what we might need. So install it with apt:

sudo apt-get install libopenssl-ruby1.8

Let’s run our rails app again:

$ ruby script/server  
=> Booting WEBrick  
=> Rails 2.3.4 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=> Call with -d to detach  
=> Ctrl-C to shutdown server  
[2009-10-19 21:21:40] INFO  WEBrick 1.3.1  
[2009-10-19 21:21:40] INFO  ruby 1.8.7 (2008-08-11) [i486-linux]  
[2009-10-19 21:21:45] INFO  WEBrick::HTTPServer#start: pid=11043 port=3000

Sweet! Looks like that solves that problem! For some reason just installing the ruby package doesn’t automatically install libopenssl-ruby1.8