Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Installing rails on Ubuntu 10.04

I am trying to install rails on Ubuntu 10.04. So far, I've executed these commands:

apt-get install build-essential libapache2-mod-passenger apache2 rubygems ruby1.8-dev libopenssl-ruby
gem install fastthread
gem install rails

Fastthread installed easily. However, trying to install rails results in:

ERROR:  Error installing rails:
    bundler requires RubyGems version >= 1.3.6

So, I tried gem -v which returned 1.3.5.

How do I upgrade rubygems? apt-get won't install above 1.3.5. And gem update --system results in:

ERROR:  While executing gem ... (RuntimeError)
    gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.

So right now I simply can't install rails, because I need a newer version of rubygems, and ubuntu won't let me upgrade my current version of rubygems.

As a side note, i tried installed rails via apt-get install rails which seemed to work, but I don't see rails as a gem when i type gem list. What's the deal with that?

Another note: The result of gem list is:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.1, 3.0.0)
actionpack (3.0.1, 3.0.0)
activemodel (3.0.1, 3.0.0)
activerecord (3.0.1, 3.0.0)
activeresource (3.0.1, 3.0.0)
activesupport (3.0.1, 3.0.0)
arel (2.0.1, 1.0.1)
builder (2.1.2)
erubis (2.6.6)
fastthread (1.0.7)
i18n (0.4.2)
mail (2.2.9)
mime-types (1.16)
mysql (2.8.1)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.6)
railties (3.0.1, 3.0.0)
rake (0.8.7)
rubygems-update (1.3.7)
thor (0.14.4)
treetop (1.4.8)
tzinfo (0.3.23)

I assume installing rails via apt-get installed those gems? Prior to installing rails through apt-get I only had mysql and fastthread.

like image 704
Tony Stark Avatar asked Nov 11 '10 03:11

Tony Stark


5 Answers

There is also a gem available which handles the update

sudo gem install rubygems-update
sudo /var/lib/gems/1.8/bin/update_rubygems
like image 164
msharp Avatar answered Oct 23 '22 13:10

msharp


You have to manually install rubygems 1.3.7 (wget from website, extract, run setup.rb).

like image 31
Tony Stark Avatar answered Oct 23 '22 13:10

Tony Stark


Install rvm and take control of your ruby environment.

http://rvm.io/

like image 23
Fábio Batista Avatar answered Oct 23 '22 12:10

Fábio Batista


This may be a newer way of doing it that wasn't available before, but I ran

sudo gem update --system

and it gave me the latest version.

like image 33
devguydavid Avatar answered Oct 23 '22 13:10

devguydavid


For some reason, Debian/Ubuntu Ruby package doesn't include the RubyGems library. Even worst, RubyGems has been bundled into Ruby 1.9.x but if you try to install it via apt-get, the package manager will force you to install them as two separate packages.

Debian/Ubuntu RubyGems package is outdated, as you noticed, and to make things even more complicated you can't upgrade the packaged version of RubyGems just installing a new RubyGems versions on top of it because the system is patched to prevent you to complete the task, as you experienced.

My suggestion is to avoid using the Ubuntu/Debian pckaged version. The alternatives are:

  1. for a development system, use RVM
  2. for a production server, install Ruby from source. If you want Ruby < 1.9 you can use Ruby Enterprise edition that is also available as Debian/Ubuntu package. If you want Ruby 1.9.x, compile it from the source.
like image 1
Simone Carletti Avatar answered Oct 23 '22 12:10

Simone Carletti