Salt - 环境安装的问题:Vagrant Up起不来

按照官网的步骤,执行Vagrant Up,没有反应,只是鼠标闪动,Google了很多,都说是Vagrant和Virtualbox版本不兼容,Windows真不行。就下载了老版本,Vbox: 4.3.40, Vagrant: 1.9.5。

版本不兼容

Vagrant Up可以运行了,但是有以下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\salt learn\salt-vagrant-demo>vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Box 'bento/ubuntu-16.04' could not be found. Attempting to find and install...
master: Box Provider: virtualbox
master: Box Version: >= 0
The box 'bento/ubuntu-16.04' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/bento/ubuntu-16.04"]
Error: The requested URL returned error: 404 Not Found

这是因为:所有的Vagrant boxes都Move到了app.vagrantup.com。

在Vagrantfile里加入以下命令:

1
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')

重新Vagrant Up,运行成功。

配置问题

下载VM完成后,失败:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
D:\salt learn\salt-vagrant-demo>vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Checking if box 'bento/ubuntu-16.04' is up to date...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" at line 66 of file VBoxManageHostonly.cpp

解决方法:
在安装目录下(c:\Program Files (x86)\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\virtualbox\action.rb),注释以下代码:

1
2
3
4
b.use PrepareNFSSettings
#b.use ClearNetworkInterfaces
#b.use Network
b.use ForwardPorts

唐胡璐 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
分享创造价值,您的支持将鼓励我继续前行!