我有一台亚马逊ec2服务器正在运行,我想在轨道上安装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安装到我的服务器上?谢谢!
答案 0 :(得分: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
答案 1 :(得分:0)
您是否拥有该计算机的超级用户权限?
如果是这样,您可以通过以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