CentOS 7 安装VirtualBox

本文档详细介绍了在CentOS 7系统中安装VirtualBox的完整过程,包括下载配置文件、安装RPMForge、DKMS、开发环境和内核,以及解决安装过程中遇到的错误,如扩展包安装失败和Guest Additions模块构建错误。通过安装kernel-devel、kernel-headers、gcc和make,最后成功设置VirtualBox。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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=<directory> and run make again. Stop.

    解决办法:

 

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

  重启

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

   大功告成!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值