1

我有一个亚马逊 ec2 服务器正在运行,我想在它的 rails 上安装 ruby​​。但是当我输入时 sudo gem install rails,它不起作用。它一直在等待。我等了30分钟。试图看看出了什么问题。这是我输入后得到的sudo gem install rails -V

GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
GET http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
GET http://rubygems.org/quick/Marshal.4.8/rack-test-0.6.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rack-test-0.6.1.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rack-test-0.6.2.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/rack-test-0.6.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/journey-1.0.4.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/journey-1.0.4.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/sprockets-2.1.3.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/sprockets-2.1.3.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/erubis-2.7.0.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/erubis-2.7.0.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/arel-3.0.2.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/arel-3.0.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.29.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.29.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.30.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.30.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.31.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.31.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.32.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.32.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.33.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.33.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/tzinfo-0.3.34.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/tzinfo-0.3.34.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/mail-2.4.4.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/mail-2.4.4.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rake-0.9.2.2.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/rake-0.9.2.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rack-ssl-1.3.2.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rack-ssl-1.3.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.14.6.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/thor-0.14.6.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.15.0.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/thor-0.15.0.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.15.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/thor-0.15.1.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.15.2.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/thor-0.15.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.15.3.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/thor-0.15.3.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.15.4.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/thor-0.15.4.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/thor-0.16.0.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/thor-0.16.0.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.4.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.4.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.5.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.5.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.5.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.5.1.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.5.2.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.5.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.5.3.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/rdoc-3.5.3.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.6.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.6.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.6.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.6.1.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.7.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.7.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.8.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/rdoc-3.8.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.9.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.9.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.9.1.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.9.1.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.9.2.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.9.2.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.9.3.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.9.3.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.9.4.gemspec.rz
302 Moved Temporarily
GET http://bb-m.rubygems.org/quick/Marshal.4.8/rdoc-3.9.4.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.10.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.10.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.11.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.11.gemspec.rz
200 OK
GET http://rubygems.org/quick/Marshal.4.8/rdoc-3.12.gemspec.rz
302 Moved Temporarily
GET http://production.cf.rubygems.org/quick/Marshal.4.8/rdoc-3.12.gemspec.rz
200 OK

它继续前进。如何将 ruby​​ on rails 安装到我的服务器上?谢谢!

4

2 回答 2

0

你有机器上的root访问权限吗?

如果是这样,您可以通过以 root 用户身份安装每个本机 gem 来使安装更顺畅。这是因为原生 gem 需要在服务器上编译代码。

警告:这并不完全安全,因此不要在高安全性生产服务器上执行此操作。

这是我做的,你可以选择任何你想要的:

sudo su
gem install bcrypt-ruby
gem install curb
gem install fastthread
gem install ffi 
gem install json 
gem install mysql2
gem install nokogiri
gem install pg
gem install rmagick
gem install ruby-prof
gem install sqlite3 
gem install ssh
gem install therubyracer

您可能还想尝试使用 ruby​​ 安装工具。我最喜欢的是 rbenv:https ://github.com/sstephenson/rbenv

于 2013-01-05T01:03:31.007 回答
0

尝试这种方式,进入源代码并:

cd ruby-1.9.2-p136/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --width-zlib-lib=/usr/lib
gem install rails --include-dependencies
于 2012-11-03T08:50:52.447 回答