2017-07-22 95 views
0

我想使用Vagrantfile和Ansible來運行VirtualBox。VirtualBox使用Vagrantfile和Ansible:VirtualBox抱怨安裝不完整

在第一個地方我在BIOS中打開虛擬化:

enter image description here

,並開啓Windows上的Linux子系統。

然後我在Windows上使用Bash。

我安裝VirtualBox:

sudo apt-get update 
sudo apt-get install virtualbox 

然後我安裝流浪:

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速龍II X2 250,3000兆赫 華碩M5A78L-M LX3 16 GB DRAM

所以,我怎麼能運行我的Vagrantfile?謝謝你的幫助!

+0

我認爲下一步(也是最後一步)是爲vbox編譯內核模塊,但我不記得那是什麼命令。 –

回答