为多台机器配置Vagrantfile - Vagrant

时间:2015-10-06 19:37:42

标签: linux vagrant virtual-machine vagrantfile

我已经设置了一个带有两个虚拟机的虚拟机盒a)Ubuntu b)Windows 10.我已经从头开始为每个虚拟机创建了流浪盒。每个流浪盒都可以单独运行。但我想立刻启动两个虚拟机。所以我在这个文档的帮助下创建了一个Vagrantfile(如下所示):https://docs.vagrantup.com/v2/multi-machine/

使用以下Vagrantfile,首先声明的框会被启动,而另一个则不会。我的Vagrantfile中有错误吗? 任何解决方案,提示如何解决这个问题?如何启动两个虚拟机?

----------- --------------- Vagrantfile

Vagrant.configure(2) do |config|

 config.vm.define "linux" do |linux|
  linux.vm.box = "ubuntu"
  linux.vm.box_url = "/Users/xyz/Desktop/vagrant/linux_package.box"
end

 config.vm.define "win" do |win|
  win.vm.box = "Windows10"
  win.vm.box_url = "/Users/xyz/Desktop/vagrant/win_package.box"
  end

config.vm.provider "virtualbox" do |v|
v.gui = true
end

end

终端输出:

首先启动linux机器时,我在终端上得到以下消息:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant
Stdout from the command:
Stderr from the command:
sudo: no tty present and no askpass program specified

1 个答案:

答案 0 :(得分:0)

登录到访客(通过gui模式)并确保在/etc/sudoers中使用修复程序设置了流浪者用户:

vagrant ALL=(ALL) NOPASSWD: ALL

以root身份运行visudo以编辑此文件。