进入 源文件夹下载适用于CentOS/RHEL引导源

# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

安装EPEL ,EPEL是yum的一个软件源,里面包含了许多基本源里没有的软件,因为是centos7所以选择第一句

CentOS/RHEL 7, 64 Bit (x86_64):
# rpm -Uvh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-9.noarch.rpm

CentOS/RHEL 6, 64 Bit (x86_64):
# rpm -Uvh http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm

安装VirtualBox5.1相关依赖包

# yum install gcc make patch dkms qt libgomp
# yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel

特别注意VirtualBox安装需要有准确对应得liunx内核版本,否则出差

yum  install  VirtualBox-5.1

安装后测执行 VirtualBox 命令,提示报错

VirtualBox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.10.0-514.6.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.
Qt FATAL: QXcbConnection: Could not connect to display
Aborted (core dumped)
sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

yum install kernel-devel-3.10.0-514.6.1.el7.x86_64
(The last command may fail if your system is not fully updated.)
yum install kernel-devel
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.
This system is not currently set up to build kernel modules (system extensions).
Running the following commands should set the system up correctly:

yum install kernel-devel-3.10.0-514.6.1.el7.x86_64
(The last command may fail if your system is not fully updated.)
yum install kernel-devel

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root.

提示内核版本不对于,按提示执行

yum install kernel-devel-3.10.0-514.6.1.el7.x86_64

yum install kernel-devel

安装所需内核版本,重装内核可用下面语句

service vboxdrv setup

后后测执行 VirtualBox 命令,出现允许正常标准

By binbin

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注