我想使用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 Professional。
我的硬件: 双核AMD Athlon II X2 250,3000 MHz 华硕M5A78L-M LX3 16 Gb DRAM
那么,我该如何运行我的Vagrantfile?谢谢你的帮助!
答案 0 :(得分:0)
我认为VirtualBox不能在Windows Linux子系统上运行:Unable to install VirtualBox in Windows Bash - Ubuntu (Windows 10)
考虑在Windows上安装VirtualBox。