我是Vagrant的新手,我有以下问题。我正在使用 Windows 8.1。
我做了以下操作:
1)首先,我从 github 将它下载到我的主机的一个文件夹中,通过这个声明:
git clone https://github.com/Udacity/ud381
2)然后我执行:
vagrant up
下载了包含来宾 VM 的 Vagrant Box
现在,当我执行vagrant up命令时,我收到以下消息:
C:\Users\Andrea\Documents\workspaces\Real-Time\ud381>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'udacity/ud381' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: Failed connect to atlas.hashicorp.com:443; No error
==> default:
==> default: If you want to check for box updates, verify your network connectio
n
==> default: is valid and try again.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 5000 => 5000 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Andrea/Documents/workspaces/Real-Time/ud381
==> default: Machine already provisioned. Run `vagrant provision` or use the `--
provision`
==> default: flag to force provisioning. Provisioners marked to run always will
still run.
我认为这是正确的,但我不确定,因为似乎我有一些警告信息,但它说:默认:机器已启动并准备就绪!所以我认为没关系(没关系吗?)
然后我尝试通过执行vagrant ssh语句的 SSH 连接到它,但我收到以下错误消息:
C:\Users\Andrea\Documents\workspaces\Real-Time\ud381>vagrant ssh
`ssh` executable not found in any directories in the %PATH% variable. Is an
SSH client installed? Try installing Cygwin, MinGW or Git, all of which
contain an SSH client. Or use your favorite SSH client with the following
authentication information shown below:
Host: 127.0.0.1
Port: 2222
Username: vagrant
Private key: C:/Users/Andrea/Documents/workspaces/Real-Time/ud381/.vagrant/machi
nes/default/virtualbox/private_key
在 Google 上搜索我发现要使用此语句,我需要将git路径放入PATH环境变量中。我检查并设置了它,实际上在PATH变量中我有这两个值:
C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\bin
第一个是 vagrant 路径,第二个是 Git 路径。
所以这不是问题。在网上搜索我还发现了这个 StacOverflow 讨论:
针对此类问题发送到此链接:https ://gist.github.com/haf/2843680
在此链接中,它显示了如何将ssh.rb文件修改到此文件夹C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb
问题是我没有这个文件夹,而是这样的:
C:\HashiCorp\Vagrant\embedded\lib\ruby\gems\2.0.0\gems\
并且此文件夹不包含vagrant-1.0.3\lib\vagrant** 子文件夹(包含 **ssh.rb文件),但包含 3 个目录,分别命名为rake-0.9.6、rdoc-4.0.0和test -unit-2.0.0.0不包含ssh.rb文件。
搜索这个文件,我在这些文件夹中发现了 2 个不同的版本:
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\kernel_v1\config
和
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\kernel_v2\config
我认为可能与教程的不同之处在于它引用了一个非常旧的 Vagrant 版本(它是 4 岁)并且我已经安装了1.7.4版本的 Vagrant。
所以我真的不知道我可以通过 SSH 连接到 Vagrant 处理的虚拟机。
你能帮助我吗?
肿瘤坏死因子