直接在Server上安装virtualbox-ose(Open Source Edition)版本后, 启动老是提示出错:
MyServer:~Starting VirtualBox kernel module vboxdrv* No suitable module for running kernel found.
后来发现官方网站上闭源版本的介绍, 真是很详尽:
MyServer:~#vi /etc/apt/sources.list
添加一句:
deb lucid contrib
MyServer:~#wget MyServer:~# apt-key add oracle_vbox.ascMyServer:~#wget -q -O- | sudo apt-key add -MyServer:~# apt-get updateMyServer:~# apt-get install virtualbox-4.0
第一次运行出错:
MyServer:~# /etc/init.d/vboxdrv setup* Stopping VirtualBox kernel modules[ OK ]* Uninstalling old VirtualBox DKMS kernel modules[ OK ]* Trying to register the VirtualBox kernel modules using DKMSError! Your kernel headers for kernel 2.6.32-28-server cannot be found at/lib/modules/2.6.32-28-server/build or /lib/modules/2.6.32-28-server/source.* Failed, trying without DKMS* Recompiling VirtualBox kernel modules* Look at /var/log/vbox-install.log to find out what went wrong
查找错误日志 /var/log/vbox-install.log 发现提示要安装linux-headers-2.6.32-28-server
apt-get install linux-headers-2.6.32-28-server
或者
apt-get install linux-headers-`uname -r`apt-get install linux-headers-generic
再次启动就正常了
MyServer:~# /etc/init.d/vboxdrv start* Starting VirtualBox kernel modules[ OK ]
运行Setup看看:
MyServer:~# /etc/init.d/vboxdrv setup* Stopping VirtualBox kernel modules[ OK ]* Uninstalling old VirtualBox DKMS kernel modules[ OK ]* Trying to register the VirtualBox kernel modules using DKMS[ OK ]* Starting VirtualBox kernel modules
如果Linux内核升级后,出现 Failed, trying without DKMS
/etc/init.d/vboxdrv setup* Stopping VirtualBox kernel modules[ OK ]* Uninstalling old VirtualBox DKMS kernel modules[ OK ]* Removing old VirtualBox netadp kernel module[ OK ]* Removing old VirtualBox netflt kernel module[ OK ]* Removing old VirtualBox kernel module[ OK ]* Trying to register the VirtualBox kernel modules using DKMS* Failed, trying without DKMS* Recompiling VirtualBox kernel modules[ OK ]* Starting VirtualBox kernel modules[ OK ]
那就安装dkms
apt-get install dkms
好了, 现在可以用普通用户的身份来使用虚拟机了Ubuntu1010是网上下载的IDE硬盘系统Ubuntu1004是自己装的Sata硬盘系统在上传虚拟机镜像之前,最好在本地打开虚拟机,清除一下网卡MAC addresses的Cache后再关机:
sudo rm /etc/udev/rules.d/70-persistent-net.rules
创建Windows的虚拟机
user@MyServer:~$VBoxManage createvm –name Ubuntu1010 –registerVirtual machine ‘Ubuntu1010’ is created and registered.UUID: b066726c-8559-48f1-b998-fd7ad742e7ceSettings file: ‘/home/user/VirtualBox VMs/Ubuntu1010/Ubuntu1010.vbox’user@MyServer:~$VBoxManage createvm –name Ubuntu1004 –registerVirtual machine ‘Ubuntu1004’ is created and registered.UUID: 9e2a7030-953e-4935-aad7-07de8269ab1cSettings file: ‘/home/www/VirtualBox VMs/Ubuntu1004/Ubuntu1004.vbox’
顺便贴一下如何删除虚拟机,包括虚拟机文件,, 下手前要三思:
user@MyServer:~$VBoxManage unregistervm Ubuntu1004 –delete
创建虚拟机所需的存储控制器
user@MyServer:~$VBoxManage storagectl Ubuntu1010 –name “IDE Controller” –add ide –controller PIIX4 –hostiocache onuser@MyServer:~$VBoxManage storagectl Ubuntu1004 –name “SATA Controller” –add sata –controller IntelAHCI –hostiocache on
穷则思变,差则思勤!没有比人更高的山没有比脚更长的路。