Installing Ruby on Rails on Ubuntu Feisty Fawn via RubyGems

Note:

Plan of attack:

This is a quick down and dirty guide to setting up Ruby on Rails in Ubuntu Feisty Fawn. You may notice this is installed into /tmp, I do this so because its universal on all Ubuntu and Linux distributions.

  • Install Ruby
  • Install RubyGems via source
  • Install Ruby on Rails using RubyGems
  • Test Rails installation

Install Ruby

Enter into the Terminal:

sudo apt-get install ruby ri irb

Install RubyGems via source

Note: Latest RubyGems (v0.9.2) as of 25th April 2007
Enter into the Terminal:

cd /tmp
wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz
tar -zxvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
sudo ruby setup.rb

Install Ruby on Rails using RubyGems

Enter into the Terminal:

sudo gem install -y rails


Note: If it fails, try executing sudo gem update Terminal and then execute the command above again.

Test Rails installation

Enter into the Terminal:

rails /tmp/railstest
cd /tmp/railstest
./script/server

Open up Firefox and go to http://localhost:3000, a page should show up indicating a successful installation. Your basically good to go with the minor exception of a database connection.

After…

Generally you’d want some sort of database connection, with the three standards choices being.

  • SQLite:
    If you just want to experiment with Ruby on Rails, I’d recommend using SQLite.
  • MySQL
  • PostgreSQL

Stay tuned!

8 Comments »

  1. Chris said,

    May 10, 2007 @ 10:54 pm

    Hello, I am trying to install rails. I install ruby and rubygems from apt and then do a sudo gem install rails --include-dependencies which runs fine, but when I type rails in a command window i get a command not found type error. Searching I find rails under /var/lib/gems/1.8/bin not under /usr/bin as expected. any idea?

    aizatto: emphasis added by me

  2. aizatto said,

    May 10, 2007 @ 11:22 pm

    Hi Chris, I see your problem. My instructions were to install RubyGems via their source, not apt-get.

    I would suggest either:

    Remove rubygems (apt-get remove rubygems) and install via my instructions

    Or:

    Add /var/lib/gems/1.8/bin to your $PATH environment. Open up your ~/.bashrc and add export PATH=$PATH:/var/lib/gems/1.8/bin. Restart your terminal, and it should work.

    Regards,
    Aizat

  3. George Smith said,

    May 23, 2007 @ 6:51 pm

    If you run into problems with your ruby install (eg: extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)) It’s because most of the stuff you need doesn’t get installed with the standard ruby.

    Help is at hand:
    http://blogs.law.harvard.edu/hoanga/2006/10/27/fixing-mkmf-load-error-ruby-in-ubuntu/

  4. Three day weekend? Time to learn RoR. at Where’s Lou said,

    May 28, 2007 @ 2:40 am

    […] I’ll install the ruby package, build gems from source, and install rails from gems. Hey! A perfect example of this approach. I’ll repeat the commands I used here, but see that resource for more […]

  5. Pete said,

    July 3, 2007 @ 12:46 pm

    Have you taken a look at http://linrails.thembid.com/ ?

  6. Wine Recommendations said,

    March 31, 2008 @ 9:48 am

    You need to create a symbolic link for the gem command.. try this

    ~$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

  7. Wine Recommendations said,

    March 31, 2008 @ 9:49 am

    sorry.. that was @chris I had the same problem without using apt-get

  8. Bruno Moura said,

    October 11, 2008 @ 3:17 am

    First I apologize my poor English.

    After to install the ruby 1.8.7 patch level 22 from the source
    on ubuntu 8.04 hardy succefully.

    Then I tryed to install rubygems 1.2 in sequence and I
    received this error message:

    xyz@xyz: /usr/local/src/rubygems-1.2.0$ sudo ruby setup.rb
    /lib/rubygems/spec_fetcher.rb:1:in `require’: no such file to load –
    zlib (LoadError)

    So I tried install zlib1g and zlib1g-dev and after this the problem has not fixed

    And I didn’t unistall ruby for reinstall and recompile…

    I tried many kind of commands like for uninstall and re-compile ruby:

    sudo apt-get remove ruby libruby libruby1.8 ruby1.8 irb rdoc ri
    sudo aptitude remove ruby
    sudo dpkg –list | grep ruby, dpkg -r
    and through Synaptic too

    And when I invoke ruby -v or irb, these commands works normally…

    How Can I fix this problem?

    Thank’s so much for help me!

    Bruno

RSS feed for comments on this post · TrackBack URI

Leave a Comment