好吧,已经知道Ruby的rubygems.org在大陆很慢很慢很慢了,所以替换成了淘宝家的ruby.taobao.org。
具体就是在puphpet/shell/install-ruby.sh里,修改原先的:
if [[ -f /.puphpet-stuff/install-ruby-1.9.3-p551 ]]; then
exit 0
fi
为
if [[ -f /.puphpet-stuff/install-ruby-1.9.3-p551 ]]; then
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
exit 0
fi
为了安全,我还在
/usr/local/rvm/bin/rvm cleanup all
下面加上了
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
但是他们看起来并没有被执行。
然后我就欢快的vagrant up了,box下载过程很顺利(事实上我两个box的下载都很顺利,但都up不起来,包括这个:(
具体提示的问题如下:
==> default: stdin: is not a tty
==> default: https://rubygems.org/ removed from sources
==> default: https://ruby.taobao.org/ added to sources
==> default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20150418-18582-urskzp.sh
==> default: stdin: is not a tty
==> default: ERROR: Could not find a valid gem 'deep_merge' (>= 0), here is why:
==> default: Unable to download data from https://ruby.taobao.org/ - no such name (https://ruby.taobao.org/specs.4.8.gz)
==> default: ERROR: Could not find a valid gem 'activesupport' (>= 0), here is why:
==> default: Unable to download data from https://ruby.taobao.org/ - no such name (https://ruby.taobao.org/specs.4.8.gz)
==> default: ERROR: Could not find a valid gem 'vine' (>= 0), here is why:
==> default: Unable to download data from https://ruby.taobao.org/ - no such name (https://ruby.taobao.org/specs.4.8.gz)
==> default: Running provisioner: puppet...
==> default: Running Puppet with site.pp...
==> default: stdin: is not a tty
==> default: Info: Loading facts in /tmp/vagrant-puppet/modules-0dbc21df9f28d2dcc14f24b7bc2688e7/concat/lib/facter/concat_basedir.rb
后面不用看了……而且大家也都知道如果Ruby这套装不好的话,虚拟机里是什么都没有的。
然后我vagrant ssh进了虚拟机,gem source -l看了下,虚拟机里的还是rubygems.org的源。
然后:
- 操作系统Fedora 21,虚拟机是 puphpet/ubuntu1404-x64
- 虚拟机启动之后,网路是通的,我能用ssh进去wget。
- 我换成了rubygems.org(也就是不改)之后,出现了一样的错误
- Ruby 版本 1.9.3-p551
- VirtualBox 4.3.26 r98988
那么问题来了,为什么会这样且如何正确安装它呢?