如何在Windows 7上使用Vagrant访问我的Virtualbox

时间:2015-04-03 15:23:49

标签: ruby-on-rails vagrant virtualbox

到目前为止我已经完成的步骤: 我已经下载了VirtualBOx和VagrantOn我的Windows7 在我的本地机器上,我在C:drive - >中创建了一个目录。 mkdir SitesVM 在Windows命令行CD'ed到SitesVM并做了       流浪汉       流浪汉       流浪汉ssh

这就是弹出的内容

C:\SitesVM>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:/SitesVM/.vagrant/machines/default/virtualbox/private_key

我按照建议安装了CYGWIN,但Cygwin不能在本地进行通信,因为它没有通过Cygwin命令行提供的任何文件。

我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

Cygwin工具(如ssh)将在Cygwin命令行中运行,但不能在Windows命令行运行。

从您当前正在使用的窗口命令行执行vagrant destroy或至少vagrant suspend。然后尝试启动Cygwin终端,切换到同一目录(cd /cygdrive/c/SitesVM),然后从那里再次启动VM(vagrant up)。

现在,您应该可以使用Cygwin bash shell中的vagrant ssh

(并非所有这些都是绝对必要的,但它可以让您更轻松地继续使用bash shell。)

如果仍然无法正常工作,则可能无法安装SSH。

从Cygwin命令行输入ssh。你应该看到:

$ ssh
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

如果正确安装了Cygwin SSH客户端。

如果显示-bash: ssh: command not found,请进入Cygwin安装程序(setup-x86.exesetup-x86_64.exe),然后在“选择包”屏幕中搜索openssh。将其从Skip切换到版本(此时为6.8p1-1)并点击下一步。这将在Cygwin中安装ssh客户端。