CentOS 7:VirtualBox抱怨内核模块未加载

dav*_*e79 -1 virtualbox kernel-module centos7

背景

我在macOS上使用VirtualBox 创建了一个沙箱 VM。它可以正确启动我可以访问的VM(运行了CentOS7)。

在此沙盒虚拟机内部,我想启动几个虚拟机,以便使用Kitchen CI&Vagrant测试Ansible Playbook,因此我通过从以下链接下载VirtualBox来安装VirtualBox:https://download.virtualbox.org/virtualbox/5.2 。 8 / VirtualBox-5.2-5.2.8_121009_el7-1.x86_64.rpm

安装后,我执行了以下命令:

[david@vmkitchen-env ansible-test]# VBoxManage --version

它返回:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (3.10.0-693.2.1.el7.x86_64) or it 
         failed to load. Please recompile the kernel module and install it 
         by
           sudo /sbin/vboxconfig

         You will not be able to start VMs until this problem is fixed.
5.2.8r121009
Run Code Online (Sandbox Code Playgroud)

我安装了开发工具,但仍然遇到相同的问题。

我认为我不需要重新编译任何内核模块。任何的想法?

在此先感谢您的帮助。

dav*_*e79 6

因此,在互联网上搜索之后,不仅在VirtualBox网站上搜索,我找到了解决方案,而且我是对的:我不需要编译任何模块。以下是对CentOS Wiki页面的引用:

https://wiki.centos.org/HowTos/Virtualization/VirtualBox

简而言之,我必须安装dkmskernel-devel打包。为此,我需要安装EPEL信息库;但就我个人而言,我更喜欢安装并启用IUS存储库。

以下是对我有用的命令集:

yum groupinstall "Development tools"

yum install https://centos7.iuscommunity.org/ius-release.rpm

yum install dkms

yum install kernel-devel

reboot

机器重新启动后,我能够使VirtualBox正常运行。

我通过命令行验证了:

[david@vmkitchen-env ansible-test]# VBoxManage --version

它返回了正确的值:

5.2.8r121009