我第一次在一个新的 Laravel Homestead VM,使用 Virtualbox 作为提供商,运行于 Windows 7 Ultimate SP1 32-bit 操作系统的主机上,测试 Vagrant 的共享选项。
我使用 MINGW32 作为shell,并关闭了Windows防火墙(域、本地和公用)以确保其不会影响我的操作。
Vagrant无法自动找到HTTP端口,所以我正在手动指定它。
如果我运行以下命令,一切都很顺利:
MINGW32 ~/Vagrant/Homestead ((v6.2.2))
$ vagrant share --http 8000
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.
For more information about the `ngrok` driver, please
refer to the documentation:
https://www.vagrantup.com/docs/share/
==> homestead-7: Detecting network information for machine...
homestead-7: Local machine address: 127.0.0.1
homestead-7:
homestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
homestead-7: share any ports you have forwarded. Assign an IP or address to your
homestead-7: machine to expose all TCP ports. Consult the documentation
homestead-7: for your provider ('virtualbox') for more information.
homestead-7:
homestead-7: Local HTTP port: 8000
homestead-7: Local HTTPS port: disabled
homestead-7: Port: 2222
homestead-7: Port: 27017
homestead-7: Port: 33060
homestead-7: Port: 44300
homestead-7: Port: 54320
homestead-7: Port: 8000
homestead-7: Port: 8025
==> homestead-7: Creating Vagrant Share session...
==> homestead-7: HTTP URL: http://3bbh648b.ngrok.io
==> homestead-7:
然而,以下命令失败:
MINGW32 ~/Vagrant/Homestead ((v6.2.2))
$ vagrant share --http 8000 --ssh
Vagrant Share now defaults to using the `ngrok` driver.
The `classic` driver has been deprecated.
For more information about the `ngrok` driver, please
refer to the documentation:
https://www.vagrantup.com/docs/share/
==> homestead-7: Detecting network information for machine...
homestead-7: Local machine address: 127.0.0.1
homestead-7:
homestead-7: Note: With the local address (127.0.0.1), Vagrant Share can only
homestead-7: share any ports you have forwarded. Assign an IP or address to your
homestead-7: machine to expose all TCP ports. Consult the documentation
homestead-7: for your provider ('virtualbox') for more information.
homestead-7:
==> homestead-7: Generating new SSH key...
homestead-7: Please enter a password to encrypt the key:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
homestead-7: Please enter a password to encrypt the key: test
homestead-7: Repeat the password to confirm:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
homestead-7: Repeat the password to confirm: test
homestead-7: Inserting generated SSH key into machine...
homestead-7: Local HTTP port: 8000
homestead-7: Local HTTPS port: disabled
homestead-7: SSH Port: 2222
homestead-7: Port: 2222
homestead-7: Port: 27017
homestead-7: Port: 33060
homestead-7: Port: 44300
homestead-7: Port: 54320
homestead-7: Port: 8000
homestead-7: Port: 8025
==> homestead-7: Creating Vagrant Share session...
C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:61:in `connect_internal': A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout (Errno::ETIMEDOUT)
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:139:in `connect'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:636:in `block in tcp'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `each'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:231:in `foreach'
from C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb:626:in `tcp'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:304:in `acquire_port'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:312:in `acquire_port'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2360:in `block in start_share'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:235:in `block in with_target_vms'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `each'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/plugin/v2/command.rb:229:in `with_target_vms'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2273:in `start_share'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-share-1.1.9/lib/vagrant-share/activate.rb:2967:in `execute'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/cli.rb:42:in `execute'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/lib/vagrant/environment.rb:308:in `cli'
from C:/Program Files/HashiCorp/Vagrant/embedded/gems/gems/vagrant-2.0.0/bin/vagrant:138:in `<main>'
我的Homestead.yml
文件如下:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/web/laravel
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/blog/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
我可以ping通192.168.10.10
。
我使用的是Vagrant 版本2.0.0
和Virtualbox 版本5.1.28 r117968 (Qt5.6.2)
。
我尝试跳转到文件C:/Program Files/HashiCorp/Vagrant/embedded/mingw32/lib/ruby/2.3.0/socket.rb
的第61行,但local_addrinfo
的输出为空。我还尝试增加变量timeout
的值,但没有成功。
请帮助我解决这个问题好吗?我不确定它是否与Windows、MINGW32、Vagrant、Virtualbox或Laravel Homestead有关。
Homestead.yml
文件内容看起来是正确的,而且我已经能够 ping 通192.168.10.10
。 - itwebdeveloperWindows 10 Pro 64-bit
上尝试了MINGW32
和PuTTY
),但是当我尝试使用相同的参数挂载磁盘时,SSHFS Manager (4every1 edition - v. 1.5.12.8)
显示以下错误:Homestead could not connect: An established connection was aborted by the server.
您是否知道在使用SSHFS Manager与ngrok
连接时是否有任何限制? - itwebdeveloper