我正在运行 Windows 10(版本 2004,内部版本 19041.388),我在本地安装了 Vagrant 和 Virtualbox。对于 Laravel 开发,我想使用 Homestead,因为它设置起来很简单。对于其他开发,我安装了 WSL2。
每次我想启动 Homestead VM 时,我都会得到这个(基本上与 this question 相同):
vagrant up --provision
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Clearing any previously set forwarded ports...
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
homestead: Adapter 1: nat
homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
homestead: 80 (guest) => 8000 (host) (adapter 1)
homestead: 443 (guest) => 44300 (host) (adapter 1)
homestead: 3306 (guest) => 33060 (host) (adapter 1)
homestead: 4040 (guest) => 4040 (host) (adapter 1)
homestead: 5432 (guest) => 54320 (host) (adapter 1)
homestead: 8025 (guest) => 8025 (host) (adapter 1)
homestead: 9600 (guest) => 9600 (host) (adapter 1)
homestead: 27017 (guest) => 27017 (host) (adapter 1)
homestead: 22 (guest) => 2222 (host) (adapter 1)
==> homestead: Running 'pre-boot' VM customizations...
==> homestead: Booting VM...
==> homestead: Waiting for machine to boot. This may take a few minutes...
homestead: SSH address: 127.0.0.1:2222
homestead: SSH username: vagrant
homestead: 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.
它基本上挂了很长时间,然后给我那个错误。我已经尝试过这些选项:
- 我重新安装了 Vagrant、Virtualbox 和 Homestead。之后,我确保勾选 Virtualbox 中的
Cable connected
框,并使用--provision
选项启动 homestead。 - 在我的 BIOS 中启用了英特尔虚拟化技术。
- 重新生成了我的 SSH key 并确保它与我的 Homestead.yaml 匹配目录
我的 Homestead.yaml 文件如下所示:
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/Bas/Projects
to: /home/vagrant/code
sites:
- map: someproject.test
to: /home/vagrant/code/someproject/public
php: '7.2'
databases:
- goeswerkt
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
我可能无法在 WSL2 旁边运行 Virtualbox 实例吗?如果是这样,我该如何解决?
最佳答案
关闭 Hyper-V 自动启动:
bcdedit/set hypervisorlaunchtype off
运行:vagrant destroy
清除:C:\Users\USER_NAME\VirtualBox VMs
如果盒子仍然存在
重启并 vagrant up
关于Laravel Homestead 在 SSH 身份验证方法 : private key on Windows 10 with WSL2 installed 处挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63373135/