博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos7.5安装VirtualBox-5.2
阅读量:5009 次
发布时间:2019-06-12

本文共 4349 字,大约阅读时间需要 14 分钟。

1.查看自己的内核版本
[root@localhost /]# rpm -qa |grep kernelkernel-tools-libs-3.10.0-862.6.3.el7.x86_64kernel-ml-4.17.6-1.el7.elrepo.x86_64kernel-tools-3.10.0-862.6.3.el7.x86_64kernel-headers-3.10.0-862.6.3.el7.x86_64
2.查看yum中VirtualBox版本
[root@localhost /]# yum list | grep VirtualBoxRepository base is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the configurationVirtualBox-4.3.x86_64                    4.3.40_110317_el7-1            virtualboxVirtualBox-5.0.x86_64                    5.0.40_115130_el7-1            virtualboxVirtualBox-5.1.x86_64                    5.1.38_122592_el7-1            virtualboxVirtualBox-5.2.x86_64                    5.2.16_123759_el7-1            virtualbox

最新版本为VirtualBox-5.2

3.导入epel安装源

yum install epel-release

4.添加VirtualBox安装源
# cd /etc/yum.repos.d/# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
5.安装相关依赖包
# yum update# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

再次查看内核版本:

[root@localhost yum.repos.d]# rpm -qa |grep kernelkernel-headers-3.10.0-862.11.6.el7.x86_64kernel-ml-4.17.6-1.el7.elrepo.x86_64kernel-tools-3.10.0-862.11.6.el7.x86_64kernel-tools-libs-3.10.0-862.11.6.el7.x86_64[root@localhost yum.repos.d]# uname -r4.17.6-1.el7.elrepo.x86_64

发现kernel-headers,kernel-tools,kernel-tools-libs小版本升级了

6.安装VirtualBox
[root@localhost /]# yum install VirtualBox-5.2
7.启动
[root@localhost hongdada]# VirtualBoxWARNING: The vboxdrv kernel module is not loaded. Either there is no module         available for the current kernel (4.17.6-1.el7.elrepo.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

明显内核版本冲突

重建VirtualBox内核模块:

[root@localhost yum.repos.d]# /usr/lib/virtualbox/vboxdrv.sh setupvboxdrv.sh: Stopping VirtualBox services.vboxdrv.sh: Starting VirtualBox services.vboxdrv.sh: Building VirtualBox kernel modules.This system is currently not set up to build kernel modules.Please install the Linux kernel "header" files matching the current kernelfor adding new hardware support to the system.The distribution packages containing the headers are probably:    kernel-devel kernel-devel-4.17.6-1.el7.elrepo.x86_64

还是不行

安装低内核版本:

[root@localhost kernels]# yum install kernel-3.10.0-862.11.6.el7.x86_64

安装kernel-devel

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

再次查看内核版本:

[root@localhost yum.repos.d]# uname -r4.17.6-1.el7.elrepo.x86_64[root@localhost yum.repos.d]# rpm -qa |grep kernelkernel-headers-3.10.0-862.11.6.el7.x86_64kernel-ml-4.17.6-1.el7.elrepo.x86_64kernel-tools-3.10.0-862.11.6.el7.x86_64kernel-3.10.0-862.11.6.el7.x86_64kernel-tools-libs-3.10.0-862.11.6.el7.x86_64

重启,选择低内核版本

8.低内核版本再次启动VirtualBox

查看内核版本,如果不一致,安装:

[root@localhost /]# yum install kernel-headers-$(uname -r) kernel-devel-$( uname -r) -y

再次重建VirtualBox内核模块

[root@localhost /]# /usr/lib/virtualbox/vboxdrv.sh setupvboxdrv.sh: Stopping VirtualBox services.vboxdrv.sh: Starting VirtualBox services.vboxdrv.sh: Building VirtualBox kernel modules.

再次启动:

[root@localhost /]# VirtualBoxQt FATAL: QXcbConnection: Could not connect to display 已放弃[root@localhost /]# systemctl start vboxdrv.service[root@localhost /]# systemctl status vboxdrv.service● vboxdrv.service - VirtualBox Linux kernel module   Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled)   Active: active (exited) since 一 2018-09-03 15:13:15 CST; 55s ago  Process: 655 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS)   Memory: 0B9月 03 15:11:14 localhost.localdomain systemd[1]: Starting VirtualBox Linux kernel module...9月 03 15:11:17 localhost.localdomain vboxdrv.sh[655]: vboxdrv.sh: Starting VirtualBox services.9月 03 15:11:17 localhost.localdomain vboxdrv.sh[990]: Starting VirtualBox services.9月 03 15:11:17 localhost.localdomain vboxdrv.sh[655]: vboxdrv.sh: Building VirtualBox kernel modules.9月 03 15:13:15 localhost.localdomain systemd[1]: Started VirtualBox Linux kernel module.

终于好了

参考:

转载于:https://www.cnblogs.com/hongdada/p/9578849.html

你可能感兴趣的文章
文字笔记
查看>>
shell获取目录下(包括子目录)所有文件名、路径、文件大小
查看>>
【bzoj3524】[Poi2014]Couriers 主席树
查看>>
【bzoj1131】[POI2008]Sta 树形dp
查看>>
【bzoj3886】[Usaco2015 Jan]Moovie Mooving 状态压缩dp+二分
查看>>
【bzoj4998】星球联盟 LCT+并查集
查看>>
[daily][btrfs][mlocate][updatedb] mlocate不认识btrfs里面的文件
查看>>
WebLogic Exception
查看>>
Python2和Python3中的rang()不同之点
查看>>
MySQL的外键,修改表,基本数据类型,表级别操作,其他(条件,通配符,分页,排序,分组,联合,连表操作)...
查看>>
UVALive 4128 Steam Roller 蒸汽式压路机(最短路,变形) WA中。。。。。
查看>>
记忆--1.致我们不可缺少的记忆
查看>>
lintcode28- Search a 2D Matrix- easy
查看>>
react项目
查看>>
C# 万年历 农历 节气 节日 星座 星宿 属相 生肖 闰年月 时辰(转)
查看>>
A Simple Tree Problem
查看>>
Modular Inverse [ZOJ 3609]
查看>>
mybatis 返回值类型是Map
查看>>
构造函数
查看>>
OkHttp 3.4入门
查看>>