1. set the yum repository.
[root@localhost ~]# wget -P /etc/yum.repos.d http://download.virtualBox.org/virtualBox/rpm/el/virtualBox.repo --2017-02-14 11:40:21-- http://download.virtualBox.org/virtualBox/rpm/el/virtualBox.repo 正在解析主机 download.virtualBox.org (download.virtualBox.org)... 65.200.22.33,65.200.22.48 正在连接 download.virtualBox.org (download.virtualBox.org)|65.200.22.33|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:259 [text/plain] 正在保存至: “/etc/yum.repos.d/virtualBox.repo” 100%[=========================================================================================================================================================================>] 259 --.-K/s 用时 0s 2017-02-14 11:40:22 (32.0 MB/s) - 已保存 “/etc/yum.repos.d/virtualBox.repo” [259/259])
2. search the available version of VirtualBox
[root@localhost ~]# yum search VirtualBox 已加载插件:fastestmirror,langpacks Loading mirror speeds from cached hostfile * base: mirrors.btte.net * elrepo: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.btte.net * updates: mirrors.btte.net ============================================================================================= N/S matched: VirtualBox ============================================================================================= VirtualBox-4.3.x86_64 : Oracle VM VirtualBox VirtualBox-5.0.x86_64 : Oracle VM VirtualBox VirtualBox-5.1.x86_64 : Oracle VM VirtualBox
3. install the specific version.
[root@localhost ~]# yum install VirtualBox-5.1 已加载插件:fastestmirror,langpacks Loading mirror speeds from cached hostfile * base: mirrors.btte.net * elrepo: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.btte.net * updates: mirrors.btte.net 正在解决依赖关系 --> 正在检查事务 ---> 软件包 VirtualBox-5.1.x86_64.0.5.1.14_112924_el7-1 将被 安装 --> 正在处理依赖关系 libSDL-1.2.so.0()(64bit),它被软件包 VirtualBox-5.1-5.1.14_112924_el7-1.x86_64 需要 --> 正在检查事务 ---> 软件包 SDL.x86_64.0.1.2.15-14.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 =================================================================================================================================================================================================================== Package 架构 版本 源 大小 =================================================================================================================================================================================================================== 正在安装: VirtualBox-5.1 x86_64 5.1.14_112924_el7-1 virtualBox 75 M 为依赖而安装: SDL x86_64 1.2.15-14.el7 base 204 k 事务概要 =================================================================================================================================================================================================================== 安装 1 软件包 (+1 依赖软件包) 总下载量:75 M 安装大小:168 M Is this ok [y/d/N]: y
run config procedure,there will be message if there are errors.
[root@localhost ~]# /sbin/vBoxconfig 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-327.36.2.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-327.36.2.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.
install kernel
yum install kernel-devel原文链接:https://www.f2er.com/centos/378747.html