CentOS 7 安装VirtualBox

1、安装virtualbox:

    1> 下载VirtualBox的RHEL软件库配置文件:

[cpp] view plaincopyprint?
 
  1. cd /etc/yum.repos.d  
  2. wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo  

    2> 安装RPMForge.

     下载http://rpmfind.net/linux/rpm2html/search.php?query=rpmforge-release(x86-64)

[cpp] view plaincopyprint?
 
  1. rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm  

    3> 安装DKMS(Dynamic Kernel Module)    

[python] view plaincopyprint?
 
  1. yum install dkms  

    4> 安装开发环境和内核:

[cpp] view plaincopyprint?
 
  1. yum groupinstall "Development Tools"   
  2. yum install kernel-devel  

     5> 安装qt和qt-

[cpp] view plaincopyprint?
 
  1. yum install qt qt-x11  
    6> 安装VirtualBox

      我是先在官网下载下来的,版本是VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm, https://www.virtualbox.org/wiki/Downloads

[cpp] view plaincopyprint?
 
  1. yum install VirtualBox-4.3-4.3.26_98988_el7-1.x86_64.rpm  

    7> 安装扩展:    

[cpp] view plaincopyprint?
 
  1. VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.16-95972.vbox-extpack   

      这个地方就出问题了。

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackFile, interface IExtPackFile, callee nsISupports
VBoxManage: error: Context: "Install(fReplace, NULL, ptrProgress.asOutParam())" at line 1140 of file VBoxManageMisc.cpp

但此时系统中已有virtualbox了,所以说这个问题可以忽略,继续接下来的。  

[cpp] view plaincopyprint?
 
  1.       8>  /usr/lib/virtualbox/vboxdrv.sh setup

     这里又出现了错误:

Building the VirtualBox Guest Additions kernel modules [FAILED] 
Your system does not seem to be set up to build kernel modules. 
Look at /var/log/vboxadd-install.log to find out what went wrong. 
Once you have corrected it, you can run /etc/init.d/vboxadd setup to build them. 
查看错误日志:
/tmp/vbox.o/Makefile.include.header:97: *** 
Error: unable to find the source of your current Linux kernel.Specify KERN_DIR= and run make again. Stop.

    解决办法:

 

[cpp] view plaincopyprint?
 
  1.     yum install kernel  
  2.     yum install kernel-devel  
  3.     yum install kernel-headers   
  4.      yum install gcc*   
  5.     yum install make  
  6.     reboot  

  重启

[cpp] view plaincopyprint?
 
  1. /usr/lib/virtualbox/vboxdrv.sh setup

   大功告成!

你可能感兴趣的:(Linux)