我想重现Vagrant如何使用ssh命令在shell脚本中记录到我的VM的方式,因此我为我的Vagrant实例创建了一个别名.
使用常规ssh命令访问它的命令语法是什么?
ssh身份验证的问题:
==> 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: Adapter 2: bridged
==> default: Forwarding ports...
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: Error: Connection timeout. Retrying...
default: …Run Code Online (Sandbox Code Playgroud) 我正在使用Ubuntu/vagrant作为我的开发环境.我在rails console上收到这些消息:
Started GET "/assets/home-fcec5b5a277ac7c20cc9f45a209a3bcd.js?body=1" for 10.0.2.2 at 2015-04-02 15:48:31 +0000
Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Run Code Online (Sandbox Code Playgroud)
是否可以禁用那些"无法呈现..."消息或以任何方式允许它们?
不知怎的,我的Vagrant项目已经解除了与VirtualBox虚拟机的关联,所以当我vagrant upVagrant将导入基础框并创建一个新的虚拟机时.
有没有办法将Vagrant项目与现有VM重新关联?Vagrant如何在内部将Vagrantfile与VirtualBox VM目录相关联?
可以有用,我发现了这个错误.常见的解决方案是重新安装virtualbox,但有更好的方法.
解
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
Run Code Online (Sandbox Code Playgroud)
要么
sudo /Library/StartupItems/VirtualBox/VirtualBox start
Run Code Online (Sandbox Code Playgroud)
VirtualBox 4.3+
在最新版本上,文件(/ Library/StartupItems/VirtualBox/VirtualBox)不存在,因此您需要使用以下命令:
sudo launchctl load /Library/LaunchDaemons/org.virtualbox.startup.plist
Run Code Online (Sandbox Code Playgroud)
错误
执行时出错
VBoxManage,Vagrant用于控制VirtualBox的CLI.命令和stderr如下所示:["hostonlyif","create"]Stderr:0%...进度状态:NS_ERROR_FAILURE VBoxManage:错误:无法创建仅限主机的适配器VBoxManage:错误:VBoxNetAdpCtl:添加新接口时出错:无法打开/ dev/vboxnetctl:没有此类文件或目录
VBoxManage:错误:详细信息:代码NS_ERROR_FAILURE(0x80004005),组件HostNetworkInterface,接口IHostNetworkInterface VBoxManage:错误:上下文:文件VBoxManageHostonly.cpp第68行的"int handleCreate(HandlerArg*,int,int*)"
关于错误的Vagrant Git问题:https://github.com/mitchellh/vagrant/issues/1671#issuecomment-22304107
我试图启动我的流浪机,所以我导航到我的vagrantfile所在的文件夹,并使用:
流浪汉&& vagrant ssh
但是我收到以下错误消息:
VirtualBox VM是使用与运行Vagrant的当前用户不匹配的用户创建的.VirtualBox要求使用相同的用户来管理创建的VM.请与该用户重新运行Vagrant.这不是一个流浪者问题.
用于创建VM的UID是:0您的UID是:501
我也试过sudo,但这也没用.
我需要切换UID吗?我该怎么做?
我正在开发一个Web服务架构.我有一些软件需要在本机主机上运行,而不是在Vagrant中运行.但我想在访客上运行一些客户服务.
Vagrant的config.vm.forwarded_port参数将打开主机上的端口并将数据发送给guest虚拟机.但是如何在guest虚拟机上打开端口并将数据发送给主机?(它仍然是端口转发,但反方向.)
我在fedora 17机器上运行vagrant 1.4和虚拟框 4.3.当我做"流浪汉"时,我收到此错误:
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: VBoxNetAdpCtl: ioctl failed for /dev/vboxnetctl: Inappropriate ioctl …Run Code Online (Sandbox Code Playgroud) 我不是在寻找这个答案,因为我的问题不同了.
当我键入时,vagrant global-status我得到一个vms列表,但其中一些目录和VM已与Vagrantfiles一起删除.
但是当我输入时vagrant destroy [machineid],我得到以下错误,我希望解决.请指教.
The working directory for Vagrant doesn't exist! This is the
specified working directory:
/Users/steven/projects/php/vagrant-laravel
Run Code Online (Sandbox Code Playgroud) 我在" 入门指南"vagrant的最后遇到了一个小问题.我正在开发运行Apache2的CentOS basebox(通过Puppet进行配置).我已使用以下行为Web请求设置端口转发Vagrantfile:
config.vm.forward_port "web", 80, 4567
Run Code Online (Sandbox Code Playgroud)
但是当我向该端口发出请求时,它们会失败.Safari报告的错误是"Safari无法打开页面" http:// localhost:4567 / ",因为服务器意外断开了连接."
我做了一个,vagrant reload并在滚动中看到"[default] - web:80 => 4567(适配器1)",那么我应该在哪里开始解决这个问题?谢谢.
vagrant ×10
virtualbox ×5
ssh ×2
apache ×1
centos ×1
command-line ×1
http ×1
private-key ×1
shell ×1
vagrantfile ×1
virtualenv ×1