While reading Linux Journal Issue 181 today, I stumbled upon a section explaining about running Ruby on Rails on Apache using an Apache module called Phusion Passenger, also known as mod_rails.

To install Passenger, I followed the instruction provided in the magazine:

sudo gem install passenger

Unxpectedly, I got the following error:

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

What’s happening? What did I do wrong?

According to a blog post by Al Hoang, a Ruby dev package needed to be installed. Well, I wouldn’t have a clue about this!

So, to FIX this, I need to install ruby1.8-dev:

$ sudo apt-get install ruby1.8-dev<br /> ...

Now, I’m ready to install Passenger gem:

$ sudo gem install passenger<br /> Building native extensions. This could take a while...<br /> Successfully installed passenger-2.2.4<br /> 1 gem installed<br /> Installing ri documentation for passenger-2.2.4...<br /> Installing RDoc documentation for passenger-2.2.4...

Credit: Fixing ‘mkmf’ load error Ruby in Ubuntu