问题:使用vagrant up指令启动linux,流程走到SSH auth method :private key时走不动,出现以下报错。
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured (“config.vm.boot_timeout” value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout (“config.vm.boot_timeout”) value.

找了好久,没有找到解决问题的档案,最后从官方github找了解决方案。我安装的是centos系统,这个系统是从科大镜像下载的,就是这个系统存在的问题,应该是这个系统和vagrant不适配,需要从https://app.vagrantup.com/boxes/search网站下载

附上我Vagrantfile

host_list = [
  {
    :name => "host1",
    :box => "centos7",
    :ip => "192.168.56.10"
  },
  {
    :name => "host2",
    :box => "centos7",
    :ip => "192.168.56.20"
  },
  {
    :name => "host3",
    :box => "centos7",
    :ip => "192.168.56.30"
  }
]

Vagrant.configure("2") do |config|
  host_list.each do |iteam|
    config.vm.define iteam[:name] do |host|
      host.vm.box = iteam[:box]
      host.vm.network "private_network", ip: iteam[:ip]
    end
  end
end

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐