如何在vagrant

时间:2015-10-13 17:41:26

标签: ruby windows powershell proxy vagrant

我在限制性代理网络上工作,目前我在笔记本电脑上工作。我不得不使用代理插件,我不得不从我的工作网络安装它。

我现在在桌面上 - 这是不可能的(在Windows上),我正在尝试配置流浪汉。我怀疑我应该输入的命令是:

vagrant plugin install --plugin-source http://rubygems.org vagrant-proxyconf

报道:

Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Could not fetch specs from http://gems.hashicorp.com/

Warning: this Gemfile contains multiple primary sources. Using `source`
more than once without a block is a security risk, and may result in 
installing unexpected gems. To resolve this warning, use a block to 
indicate which gems should come from the secondary source. To upgrade
this warning to an error, run `bundle config disable_multisource true`.

我认为这与代理问题有关。我已经尝试了cmdPowerShell以及

set http_proxy=xxxxx:80

有什么建议吗?如果可能的话,我很乐意进行手动安装。

谢谢!

1 个答案:

答案 0 :(得分:2)

您需要在Vagrant主机中设置代理环境变量,以便它知道如何下载插件。

例如:

$ export http_proxy=http://192.0.2.1:3128
$ export https_proxy=http://192.0.2.1:3128

$ env | grep http  # just checking
http_proxy=http://192.0.2.1:3128
https_proxy=http://192.0.2.1:3128

$ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-proxyconf (1.5.2)'!