How to install Rails 3.0 beta on Ubuntu Linux (step by step)

UPDATE: If you are looking for a way to deploy a Rails 3 app in production on a shared web hosting please look here

Wow, Rails 3.0 beta gem is out but, but the instruction advertised on the blog doesn't work on Ubuntu Linux and the older one too :(
Here is an hacky but working way to install Rails 3 on a clean Ubuntu installation.


(replace pre with beta)

UPDATE: ruby 1.9 is any longer supported please use ruby 1.9.1 instead! Or better use ruby 1.8 if u want a stable environment :P

Rails 3.0 beta with Ruby 1.9.1 on Ubuntu Linux

sudo apt-get install ruby1.9-dev libsqlite3-dev rdoc1.9 libopenssl-ruby1.9 giggle
tar -xvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby1.9 setup.rb
sudo ln -s /usr/bin/ruby1.9 /usr/bin/ruby
sudo ln -s /usr/bin/gem1.9 /usr/bin/gem

Now the ruby and the gem environment is ready and you'll have fun with the new rails' dependencies. The faster way to get them is via rails3b

sudo gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n sqlite3-ruby
sudo gem install rails --pre

The "theoretical" installation is finished and you should be able to start a new application almost as in rails 2.x

rails myapp
cd myapp
rails server
# go to localhost:3000

Fixes to some common errors

<internal:gem_prelude>:114:in `push_gem_version_on_load_path': undefined method `<=>' for nil:NilClass (NoMethodError)

You need to set up the GEM_HOME variable

export GEM_HOME=/usr/lib/ruby1.9/gems/1.9.0

undefined method `default_external=' for Encoding:Class (NoMethodError)

Comment the line that contains it.

require': no such file to load -- ftools (LoadError)

sudo apt-get install rpl
cd /usr/lib/ruby1.9/gems/1.9.0/gems/
sudo rpl -R "require 'ftools'" "" *

other issues with the bin path

# put this lines in $HOME/.bashrc
export GEM_HOME=/usr/lib/ruby1.9/gems/1.9.0
export PATH=$PATH:/usr/lib/ruby1.9/gems/1.9.0/gems/railties-3.0.0.beta/bin

Be careful that you may reapply these fixes if you update some gems!


Passforsure provide guaranteed braindumps for all kind of certification exam including 642-383 and 642-661.