Error installing Rails on Ubuntu 11.10 (Gem::DependencyError)

I'm trying to install Ruby on Rails on Ubuntu 11.10, but receiving this

    $ sudo gem install rails
    ERROR: While executing gem ... (Gem::DependencyError)
        Unable to resolve dependencies: rails requires activesupport (=
3.2.3), actionpack (= 3.2.3), activerecord (= 3.2.3), activeresource (=
3.2.3), actionmailer (= 3.2.3), railties (= 3.2.3)

How can I fix this?

Note: Git ( ) and Ruby (1.9.2p290) are installed properly.

How did you installed Ruby?
Do you have an updated rubygems?

gem update --system

Actually, that might not work on a Debian based distro if rubygems has
been installed via apt packages.
That's why I asked how Ruby was installed.

I strongly advise that you use rvm to install ruby and rails (I am
assuming that you are not using rvm as you have used sudo on gem



Colin is right, using RVM has lots of advantages! You can have
multiple Rubies and Gem versions, Gemsets for projects, etc. Highly
recommend because without it you're gonna have a tone of Gem version
problems later.

We made a 1 line script for Ubuntu which installs Wayne's RVM, with
RVM installs a Ruby version 1.9.2 then creates a Gemset which installs
Rails3.2. Just updated it for you! :slight_smile:
Would be great if you'd give a try. Report me back how it worked
please, I'd like to publish it.

Welcome on Rails!