Ubuntu下VirtualBox的安装
官方源里的是virtualbox-ose ,开源版本
可以自行到virtualbox.org下载 http://www.virtualbox.org/wiki/Linux_Downloads
注意平台的选择
下载的是DEB包,直接安装,由于内核的更新产生以下的错误:
VirtualBox will not start until this problem is fixed. Please consult /var/log/vbox-install.log to find out why the kernel module does not compile. Most probably the kernel sources were not found. Install them (the package name is probably linux-headers-<version> whereby <version> can be determined by 'uname -r') and execute
/etc/init.d/vboxdrv setup
as root.
由于virtualbox要根据内核的版本重新编译,但是我们的更新是在源里直接进行的,没有存储相应的内核源文件
使用如下命令:
sudo apt-get install linux-headers-$(uname -r)
sudo /etc/init.d/vboxdrv setup
进行virtualbox的重新编译
virtualbox 与kvm冲突的解决办法:
lsmod |grep kvm
确认自己的模块是kvm_intel还是kvm_amd
例如
sudo rmmod kvm_amd
或者:sudo modprobe -r kvm_amd
就可以启动virtualbox
切换回kvm
rmmod vboxdrv
rmmod vboxnetadp
rmmod vboxnetflt
modprobe kvm
modprobe kvm_amd
可以写一个切换脚本
#!/bin/bash
NOW_VM=`lsmod | grep vbox`
if [ x"$NOW_VM" = x"" ] ; then
echo "Now is kvm, swithing to vbox..."
sudo rmmod kvm_amd
sudo rmmod kvm
sudo modprobe vboxdrv
sudo modprobe vboxnetadp
sudo modprobe vboxnetflt
else
echo "Now is vbox, swithing to kvm..."
sudo rmmod vboxnetflt
sudo rmmod vboxnetadp
sudo rmmod vboxdrv
sudo modprobe kvm
sudo modprobe kvm_amd
fi
echo "Switching from to xxx done."
lsmod | grep kvm
lsmod | grep vbox
echo "enjoy it now!"