centos 7 install VirtualBox

本文介绍如何在Linux系统上设置VirtualBox仓库,搜索可用版本,并安装指定版本的VirtualBox。此外,还介绍了配置过程中可能遇到的问题及解决方案。

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


提供的引用内容主要是关于在VirtualBox 6.1版本安装CentOS 7系统的信息,未涉及在CentOS 7系统上安装VirtualBox 6.1的方法。以下是一般情况下在CentOS 7系统上安装VirtualBox 6.1的详细步骤: ### 1. 添加VirtualBox官方仓库 首先需要添加VirtualBox的官方仓库,以便从官方源获取安装包。可以通过创建一个repo文件来实现: ```bash sudo tee /etc/yum.repos.d/virtualbox.repo <<EOF [virtualbox] name=Oracle Linux / RHEL / CentOS-\$releasever / \$basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/el/\$releasever/\$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc EOF ``` ### 2. 安装必要的依赖 在安装VirtualBox之前,需要安装一些必要的依赖包,以确保安装过程顺利进行: ```bash sudo yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r) dkms gcc make perl ``` ### 3. 安装VirtualBox 6.1 使用yum命令来安装VirtualBox 6.1: ```bash sudo yum install -y VirtualBox-6.1 ``` ### 4. 加载内核模块 安装完成后,需要加载VirtualBox的内核模块: ```bash sudo /sbin/vboxconfig ``` ### 5. 添加用户到vboxusers组 为了能够正常使用VirtualBox,需要将当前用户添加到vboxusers组中: ```bash sudo usermod -aG vboxusers $USER ``` ### 6. 重启系统 最后,重启系统使所有更改生效: ```bash sudo reboot ``` ### 7. 验证安装 系统重启后,可以通过以下命令验证VirtualBox是否安装成功: ```bash VBoxManage --version ``` 如果成功安装,会显示VirtualBox的版本号。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值