Installing Ruby on Rails on Fedora Core 17

This is a quick-and-dirty how-to on getting the Ruby on Rails (RoR) example to work on Fedora Core 17:

First of all you need to install ruby:

sudo yum install ruby

Normally, yum will also install stuff like gems, if it doesn’t:

sudo yum install rubygems

Now we can install rails using gem:

gem install rails

If you ever want to install the 2.x version of Rails you can use the following command to find the available version:

gem list --remote --all rails

*** REMOTE GEMS ***

rails (3.2.8, 3.2.7, 3.2.6, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0, 3.1.8, 3.1.7, 3.1.6, 3.1.5, 3.1.4, 3.1.3, 3.1.2, 3.1.1, 3.1.0, 3.0.17, 3.0.16, 3.0.15, 3.0.14, 3.0.13, 3.0.12, 3.0.11, 3.0.10, 3.0.9, 3.0.8, 3.0.7, 3.0.6, 3.0.5, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.3.14, 2.3.12, 2.3.11, 2.3.10, 2.3.9, 2.3.8, 2.3.7, 2.3.6, 2.3.5, 2.3.4, 2.3.3, 2.3.2, 2.2.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.2.6, 1.2.5, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.6, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.0, 0.14.4, 0.14.3, 0.14.2, 0.14.1, 0.13.1, 0.13.0, 0.12.1, 0.12.0, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.5, 0.9.4.1, 0.9.4, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.5, 0.8.0)
...

and the specify the version to install

gem install rails --version 2.3.11

This is the easy part 🙂

At a given moment you’ll be asked to install sqlite3-ruby and chances are that you get the following error:

Fetching: sqlite3-1.3.6.gem (100%)
Building native extensions.  This could take a while...
...........
ERROR:  Error installing sqlite3-ruby:
	ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
checking for sqlite3.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/ruby
	--with-sqlite3-dir
	--without-sqlite3-dir
	--with-sqlite3-include
	--without-sqlite3-include=${sqlite3-dir}/include
	--with-sqlite3-lib
	--without-sqlite3-lib=${sqlite3-dir}/lib
	--enable-local
	--disable-local
/usr/share/ruby/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/share/ruby/mkmf.rb:506:in `try_cpp'
	from /usr/share/ruby/mkmf.rb:970:in `block in find_header'
	from /usr/share/ruby/mkmf.rb:790:in `block in checking_for'
	from /usr/share/ruby/mkmf.rb:284:in `block (2 levels) in postpone'
	from /usr/share/ruby/mkmf.rb:254:in `open'
	from /usr/share/ruby/mkmf.rb:284:in `block in postpone'
	from /usr/share/ruby/mkmf.rb:254:in `open'
	from /usr/share/ruby/mkmf.rb:280:in `postpone'
	from /usr/share/ruby/mkmf.rb:789:in `checking_for'
	from /usr/share/ruby/mkmf.rb:969:in `find_header'
	from extconf.rb:34:in `<main>'

There are multiple reasons:

  • gcc isn’t installed
  • The sqlite3 headers are missing

You can install the missing dependencies with the following command:

sudo yum install gcc libsqlite3x-devel

Now you can install the sqlite3 support for Ruby (FYI: the gem is now called sqlite3 instead of sqlite3-ruby.

gem install sqlite3-ruby
Building native extensions.  This could take a while...
....
..........................

Fetching: sqlite3-ruby-1.3.3.gem (100%)

#######################################################

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3.  Rather than
installing `sqlite3-ruby`, you should install `sqlite3`.  Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

❤ ❤ ❤ ❤

#######################################################

Successfully installed sqlite3-1.3.6
Successfully installed sqlite3-ruby-1.3.3

Advertisements

3 thoughts on “Installing Ruby on Rails on Fedora Core 17

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s