【发布时间】:2017-12-28 07:41:50
【问题描述】:
我想使用 Vagrantfile 和 Ansible 运行 VirtualBox。
首先我在 BIOS 中打开虚拟化:
并在 Windows 上打开 Linux 子系统。
然后我在 Windows 上使用 Bash。
我安装了 VirtualBox:
sudo apt-get update
sudo apt-get install virtualbox
然后我安装 Vagrant:
sudo apt-get update
sudo apt-get install vagrant
然后我安装 Ansible:
sudo apt-get install software-properities-common
sudo apt-get-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
我有 Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
IP = "192.168.33.55"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/xenial64" #target OS: Ubuntu 16.04 LTS
config.ssh.insert_key = false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.ssh.username = "ubuntu"
config.vm.provider :virtualbox do |v|
v.name = "jenkins"
v.memory = 1024
v.cpus = 2
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
end
config.vm.hostname = "jenkins"
config.vm.network :private_network, ip: "192.168.33.55"
config.vm.network "forwarded_port", guest: 80, host: 8080
# Set the name of the VM. See: http://stackoverflow.com/a/17864388/100134
config.vm.define :jenkins do |jenkins|
end
# Ansible provisioner.
config.vm.provision "ansible" do |ansible|
ansible.playbook = "jenkins/playbook.yml"
ansible.inventory_path = "jenkins/inventory"
ansible.sudo = true
end
end
所以,我尝试运行它
vagrant up
但我有一个错误:
VirtualBox is complaining that the installation is incomplete. Please run `VBoxManage --version` to see the error message which should contain instructions on how to fix this error
当然,我会检查:
VBoxManage --version
我明白了:
The character device /dev/vboxdrv does not exist. Please install the virtualbox-dkms package and the appropriate headers, most likely linux-headers-3.4.0+. You will not be able to start VMs until this problem is fixed
当我尝试安装它时
apt-get install virtualbox-dkms
表示已安装最新版本。
我也试过了:
sudo dpkg-reconfigure virtualbox-dkms
成功,但错误仍然在这里
sudo apt-get install linux-headers-generic
成功,但错误仍然在这里
我的 CPU 不支持 BIOS 中的安全启动。
我有 Windows 10 专业版。
我的硬件: 双核 AMD Athlon II X2 250, 3000 MHz 华硕 M5A78L-M LX3 16 Gb DRAM
那么,我该如何运行我的 Vagrantfile?感谢您的帮助!
【问题讨论】:
-
我认为下一步(也是最后一步)是为 vbox 编译内核模块,但我不记得那是什么命令了。
标签: vagrant ansible windows-10 virtualbox vagrantfile