LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Installing Ruby on Rails -- "gem update --system is disabled on Debian". (https://www.linuxquestions.org/questions/debian-26/installing-ruby-on-rails-gem-update-system-is-disabled-on-debian-749743/)

bartonski 08-23-2009 06:14 PM

Installing Ruby on Rails -- "gem update --system is disabled on Debian".
 
1 Attachment(s)
I've found myself in a bit of a quandary while installing Ruby on Rails on my Lenny box.

Short version: When I try to install all of the ruby gems needed to run Ruby on Rails, I get to a point where ruby requires rubygems v. 1.3.1. According to ruby, the recommended method of upgrade is "gem update --system", however I get the following error when I try this:

Code:

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.

As far as I can tell, the Debian repositories for Lenny don't have any versions of rubygems higher than 1.2.0.


Long Version
(i.e. How the @$# did you get yourself into this mess?)

I started by doing an apt-get install of rails and rubygems.

I had read that the Debian packaging standards don't play nice with the way that Ruby installs files, so I decided to install everything from that point using 'gem install' rather than apt-get.

A transcript of the steps that I took is here: Attachment 1306.

At this point, I ran into the error quoted above.

I backed out all of the gem installs that I had done so far, using "gem uninstall", and ran "apt-get install rails".

Then tried typing 'rails -v' and got something like this: (sorry, the exact error message has scrolled out of the terminal line buffer)

rails: /var/lib/gems/1.8/bin/rails no file or directory.

Code:

$ type rails
rails is hashed (/usr/bin/rails)

and /usr/bin/rails was trying to call /var/lib/gems/1.8/bin/rails.

Ok... no harm, no foul, now that I've done the proper apt-get install rails, presumably something has changed so that when I start resolving the cascade of dependencies, I won't need to upgrade rubygems... gem install rails, gem install test-spec, gem install camping, gem install fcgi, gem install memcache-client, gem install mongrel, gem install ruby-openid -v "~> 2.0.0" (#@$% versioning error), gem install thin...

Finally, rails -v gives me "Rails 2.3.3".

Code:

$ rails hello
      create 
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers

... chug chug chug

when all the directories are created,

Code:

$ cd hello

$ script/server
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.

$ sudo gem update --system
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.

:confused::banghead:

I think that I must have taken a wrong turn from the Debian way when I started installing everything as gems at the beginning, but I'm not clear as to how to rectify the situation. AFAIK, gem uninstall is a fairly clean uninstall; after I uninstalled all of the gems after the first go-around, I would have thought that "apt-get install rails" should have installed the necessary version of rubygems and all of the correct version of all of the gems that ruby requires, alas it is not so.

Any and all suggestions welcome.

bartonski 08-23-2009 08:33 PM

Install rubygems from source
 
It seems that the answer is probably to install Rubygems from source. Look here for details: http://articles.slicehost.com/2009/4...-ruby-on-rails

Will post results after I've tried this.

bartonski 08-23-2009 09:17 PM

worked like a charm.
 
Installing rubygems from source was dead simple, and I've got a working rails install.


All times are GMT -5. The time now is 08:18 PM.