简体   繁体   English

在Ubuntu 10.04上安装rails时出错

[英]Error Installing rails on Ubuntu 10.04

I am trying to install rails on Ubuntu 10.04. 我想在Ubuntu 10.04上安装rails。 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. Fastthread安装Fastthread However, trying to install rails results in: 但是,尝试安装rails会导致:

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

So, I tried gem -v which returned 1.3.5 . 所以,我尝试了gem -v ,返回1.3.5

How do I upgrade rubygems? 如何升级rubygems? apt-get won't install above 1.3.5. apt-get不会安装在1.3.5以上。 And gem update --system results in: 并且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.

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. 所以现在我根本无法安装rails,因为我需要更新版本的rubygems,而且ubuntu不会让我升级我当前版本的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 . 作为旁注,我尝试通过apt-get install rails似乎可以工作,但是当我输入gem list时,我没有看到rails作为gem list What's the deal with that? 这有什么用?

Another note: The result of gem list is: 另一个注意事项: gem list的结果是:

*** 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? 我假设通过apt-get安装导轨那些宝石? Prior to installing rails through apt-get I only had mysql and fastthread. 在通过apt-get安装rails之前,我只有mysql和fastthread。

There is also a gem available which handles the update 还有一个可用于处理更新的gem

sudo gem install rubygems-update
sudo /var/lib/gems/1.8/bin/update_rubygems

你必须手动安装rubygems 1.3.7(从网站wget,解压缩,运行setup.rb)。

Install rvm and take control of your ruby environment. 安装rvm并控制您的ruby环境。

http://rvm.io/ http://rvm.io/

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. 它给了我最新版本。

For some reason, Debian/Ubuntu Ruby package doesn't include the RubyGems library. 出于某种原因,Debian / Ubuntu Ruby包不包含RubyGems库。 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. 甚至最糟糕的是,RubyGems已经捆绑到Ruby 1.9.x中但是如果你尝试通过apt-get安装它,那么包管理器会强制你将它们安装为两个独立的包。

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. 正如您所注意到的,Debian / Ubuntu RubyGems软件包已经过时了,为了使事情变得更加复杂,您无法升级RubyGems的打包版本,只需在其上安装新的RubyGems版本,因为系统已修补以防止您完成任务,就像你经历的那样。

My suggestion is to avoid using the Ubuntu/Debian pckaged version. 我的建议是避免使用Ubuntu / Debian pckaged版本。 The alternatives are: 替代方案是:

  1. for a development system, use RVM 对于开发系统,请使用RVM
  2. for a production server, install Ruby from source. 对于生产服务器,从源代码安装Ruby。 If you want Ruby < 1.9 you can use Ruby Enterprise edition that is also available as Debian/Ubuntu package. 如果你想要Ruby <1.9,你可以使用也可以作为Debian / Ubuntu包提供的Ruby Enterprise版本。 If you want Ruby 1.9.x, compile it from the source. 如果你想要Ruby 1.9.x,请从源代码编译它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM