centos 7 install VirtualBox

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 #### 下载并安装 VirtualBox 对于未安装 VirtualBox 的情况,可以从官方网站获取最新版本进行安装[^2]。确保所使用的操作系统支持该版本的 VirtualBox。 #### 安装必要的依赖包 为了使 VirtualBox 能够正常工作,在 CentOS 7 上需先安装一些必需的软件包来准备环境: ```bash sudo yum update -y sudo yum groupinstall -y "Development Tools" sudo yum install -y kernel-devel kernel-headers dkms qt gcc make perl bzip2 ``` 这些命令会更新现有程序包至最新版本,并安装开发工具组以及编译内核模块所需的文件和其他必要组件[^3]。 #### 安装 VirtualBox 及其服务 完成上述准备工作之后,可以继续通过 YUM 来安装特定版本的 VirtualBox 并启动相关服务: ```bash sudo rpm -Uvh https://download.virtualbox.org/virtualbox/6.1/VirtualBox-6.1-6.1.38_153438_el7-1.x86_64.rpm sudo systemctl start vboxdrv.service sudo systemctl enable vboxdrv.service ``` 这里假设选择了 VirtualBox 版本 6.1 进行安装;请注意根据实际情况调整 URL 和版本号。 #### 配置增强功能 (Optional) 如果希望进一步提升性能体验,则可考虑安装 `VBoxGuestAdditions` 工具集。这通常涉及挂载由宿主机提供的 ISO 文件到客户机中执行安装过程[^4]。 ```bash mkdir /mnt/cdrom mount /dev/cdrom /mnt/cdrom/ cd /mnt/cdrom sh VBoxLinuxAdditions.run reboot ``` 以上操作完成后重启系统以应用更改,此时应该能够享受到更好的图形显示效果和支持共享剪贴板等功能特性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值