Installing Ruby on Rails on Ubuntu Feisty Fawn via RubyGems
Note:
- I recommend installing Ruby on Rails via RubyGems
- As long as you have Ruby installed, you can install Ruby on Rails, just skip the step about installing Ruby.
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
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!



Chris said,
May 10, 2007 @ 10:54 pm
Hello, I am trying to install rails. I install
rubyandrubygemsfrom apt and then do asudo gem install rails --include-dependencieswhich runs fine, but when I typerailsin a command window i get a command not found type error. Searching I find rails under/var/lib/gems/1.8/binnot under/usr/binas expected. any idea?–
aizatto: emphasis added by me
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 instructionsOr:
Add
/var/lib/gems/1.8/binto your $PATH environment. Open up your~/.bashrcand addexport PATH=$PATH:/var/lib/gems/1.8/bin. Restart your terminal, and it should work.Regards,
Aizat
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/
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 […]
Pete said,
July 3, 2007 @ 12:46 pm
Have you taken a look at http://linrails.thembid.com/ ?
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
Wine Recommendations said,
March 31, 2008 @ 9:49 am
sorry.. that was @chris I had the same problem without using apt-get
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