今天在centos服务器上安装beef-xss时要安装bundler。一直不成功。最后找到解决方案如下:
安装Bundler Gem:
sudo gem install bundler --no-ri --no-rdoc
安装过程中会出现下面的错误:
[root@h77 ruby-2.0.0-p353]# gem install bundler --no-ri --no-rdoc
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Connection timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
是因为国内网络导致rubygems.org存放在Amazon S3上面的资源文件间歇性连接失败,用国内的RubyGems镜像(参见http://ruby.taobao.org/)替换官方镜像,方法如下:
[root@h77 ruby-2.0.0-p353]# gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
[root@h77 ruby-2.0.0-p353]# gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources
[root@h77 ruby-2.0.0-p353]# gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
[root@h77 ruby-2.0.0-p353]# gem install bundler --no-ri --no-rdoc
Fetching: bundler-1.7.6.gem (100%)
Successfully installed bundler-1.7.6
1 gem installed
对于gem:
- $ gem sources --remove https://rubygems.org/
- $ gem sources -a http://ruby.taobao.org/
- $ gem sources -l
- *** CURRENT SOURCES ***
- http://ruby.taobao.org
- # 请确保只有 ruby.taobao.org
- $ gem install rails
对于boundle:
修改Gemfile文件,将默认的
source 'http://rubygems.org'
改成
source 'https://ruby.taobao.org/'