我开始创建一个新的虚拟机用于开发,因为我的ubuntu 14.4似乎已经过时了。
我打算将来切换到 ubuntu 17.10,但在第一次安装时失败了。
这是我的流浪文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "1024"
end
config.vm.box = "generic/ubuntu1710"
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: false
config.vm.network "private_network", ip: "192.168.37.200"
end
在配置期间,我得到了这个
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown 'eth1' || true
/sbin/ip addr flush dev 'eth1'
# Remove any previous network modifications from the interfaces file
sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre
sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tac | sed -e '/^#VAGRANT-END/,$ d' | tac > /tmp/vagrant-network-interfaces.post
cat
/tmp/vagrant-network-interfaces.pre
/tmp/vagrant-network-entry
/tmp/vagrant-network-interfaces.post
> /etc/network/interfaces
rm -f /tmp/vagrant-network-interfaces.pre
rm -f /tmp/vagrant-network-entry
rm -f /tmp/vagrant-network-interfaces.post
/sbin/ifup 'eth1'
Stdout from the command:
Stderr from the command:
bash: line 4: /sbin/ifdown: No such file or directory
bash: line 20: /sbin/ifup: No such file or directory
计算机无法通过托管窗口使用。在预配之前,我是否必须安装某些内容?还是您更喜欢哈希科布的另一个机器模板?
问候N00N
Vagrant 目前无法与 Ubuntu 17.10 一起使用,因为删除了传统的网络配置工具和文件:/sbin/ifup
和 /sbin/ifdown
。
但是,您可以使用以下解决方法创建具有网络接口的无路 VM:
1.将安装ifupdown
添加到您的流浪文件中:
# -*- mode: ruby -*-
# vi: set ft=ruby :
$provision_script = <<PROVISION
apt-get -y update
apt-get install ifupdown -y
PROVISION
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $provision_script
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "1024"
end
config.vm.box = "generic/ubuntu1710"
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: false
config.vm.network "private_network", ip: "192.168.37.200"
end
阿拉伯数字。创建流浪虚拟机:
vagrant up
当然,它因有问题的错误而失败。
3.在刚刚创建的 VM 中启动预配脚本。它使用必要的文件安装软件包ifupdown
:
vagrant provision
4.现在重新加载 VM:
vagrant reload
对于 RHEL 框,您可以添加nm_controlled
以使其正常工作:
qa.vm.network "private_network", ip: "10.11.12.2", nm_controlled: "yes"
请参阅此处的流浪源代码。
它在MacOS 13.2.1(Ventura(,Virtualbox 7.0.6,vagrant 2.3.4上对我有用。