yum 安装VirtualBox

nstall VirtualBox 4.1.8 on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.7

virtualbox-logo-smallOracle VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. VirtualBox is a general-purpose full virtualizer for x86 hardware. Targeted at server, desktop and embedded use, it is now the only professional-quality virtualization solution that is also Open Source Software.

VirtualBox supports a large number of guest operating systems:

  • Windows 3.x
  • Windows NT 4.0
  • Windows 2000
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • Windows 7
  • DOS
  • Linux (2.4, 2.6, 3.0, 3.1)
  • Solaris
  • OpenSolaris
  • OpenBSD

This guide shows howto install VirtualBox 4.1 (currently 4.1.8) on Fedora 16/15/14/13/12, CentOS 6.2/6.1/6/5.7, Red Hat (RHEL) 6.2/6.1/6/5.7. This howto uses Virtual Box yum repositories.

1. Change to root User

su -
## OR ##
sudo -i

2. Install Fedora or RHEL Repo Files

cd /etc/yum.repos.d/
 
## Fedora 16/15/14/13/12 users
wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
 
## CentOS 6.1/6/5.7 and Red Hat (RHEL) 6.1/6/5.7 users
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

3. Update latest packages and check your kernel version

Update packages

yum update

Check that that you are running latest installed kernel version
Output of following commands version numbers should match:

rpm -qa kernel |sort |tail -n 1
 
uname -r

Note: If you got kernel update or run older kernel than newest installed then reboot:

reboot

4. Install following dependency packages

CentOS 5 and Red Hat (RHEL) 5 needs EPEL repository, install it with following command:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
 
## PAE kernel users install ##
yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms

5. Install VirtualBox Latest Version 4.1 (currently 4.1.8)

yum install VirtualBox-4.1

Note:
This command create automatically vboxusers group and VirtualBox user must be member of that group.
This command also build needed kernel modules.

Rebuild kernel modules with following command:

/etc/init.d/vboxdrv setup
## OR ##
service vboxdrv setup

6. Add VirtualBox User(s) to vboxusers Group

Replace user_name with your own user name or some another real user name.

usermod -a -G vboxusers user_name

7. Start VirtualBox

Use launcher from menu or simply run:

VirtualBox

Troubleshooting

If you have problems with KERN_DIR parameter or your kernel directory is not automatically detected then set KERN_DIR environment variable manually, using following method:

## Current running kernel on Fedora ##
KERN_DIR=/usr/src/kernels/`uname -r`
 
## Current running kernel on CentOS and Red Hat (RHEL) ##
KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m`
 
## Fedora example ##
KERN_DIR=/usr/src/kernels/2.6.33.5-124.fc13.i686
 
## CentOS and Red Hat (RHEL) example ##
KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64
 
## Export KERN_DIR ##
export KERN_DIR

文章出自

http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/


在Linux系统上安装VirtualBox可以通过多种方式实现,包括使用系统的包管理器(如`yum`、`dnf`或`apt`)或者从Oracle官方下载相应的二进制文件进行安装。以下是几种常见Linux发行版的安装方法。 ### 安装 VirtualBoxCentOS 7 上 对于 CentOS 7 系统,可以使用 `yum` 包管理器来安装 VirtualBox 5.2 版本[^1]: 1. **添加 VirtualBox 仓库**: ```bash sudo wget -P /etc/yum.repos.d http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo ``` 2. **安装 VirtualBox 5.2**: ```bash sudo yum install VirtualBox-5.2.x86_64 ``` 3. **重建内核模块**: 安装完成后,需要运行以下命令以确保 VirtualBox 的内核模块正确加载: ```bash sudo /usr/lib/virtualbox/vboxdrv.sh setup ``` 这将停止并重新启动 VirtualBox 服务,并构建所需的内核模块。 ### 安装 VirtualBox 在 Debian 10 上 如果你使用的是 Debian 10 系统,可以按照以下步骤安装 VirtualBox 6.1 版本[^3]: 1. **添加 VirtualBox 官方仓库**: 编辑 `/etc/apt/sources.list` 文件,添加如下内容: ``` deb https://download.virtualbox.org/virtualbox/debian buster contrib ``` 2. **添加 Oracle 公钥**: ```bash wget -qO- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo apt-key add - ``` 3. **更新软件包列表并安装 VirtualBox**: ```bash sudo apt update sudo apt install virtualbox-6.1 ``` 4. **安装 Linux 头文件**: 如果你的内核版本是 `5.10.0-7`,但找不到对应的 `linux-headers` 包,可以尝试安装更高版本的头文件,例如 `5.10.0-8`: ```bash sudo apt install linux-headers-5.10.0-8-amd64 ``` 5. **配置 VirtualBox 内核模块**: 安装完成后,重启系统并选择新安装的内核版本启动,然后运行以下命令以确保 VirtualBox 正常工作: ```bash sudo /sbin/vboxconfig ``` ### 安装 VirtualBox 在 Ubuntu 上 对于 Ubuntu 用户,也可以通过官方仓库或 VirtualBox 官方源来安装最新版本的 VirtualBox: 1. **添加 VirtualBox 官方仓库**: 编辑 `/etc/apt/sources.list` 文件,添加如下内容(假设你使用的是 Ubuntu 20.04 LTS): ``` deb https://download.virtualbox.org/virtualbox/debian focal contrib ``` 2. **添加 Oracle 公钥**: ```bash wget -qO- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo apt-key add - ``` 3. **更新软件包列表并安装 VirtualBox**: ```bash sudo apt update sudo apt install virtualbox-6.1 ``` 4. **安装必要的依赖项**: ```bash sudo apt install build-essential dkms ``` 5. **重新编译 VirtualBox 内核模块**: ```bash sudo /sbin/vboxconfig ``` ### 验证安装 安装完成后,可以通过以下命令验证 VirtualBox 是否成功安装: ```bash VBoxManage --version ``` 这将显示当前安装VirtualBox 版本号。 此外,你还可以通过图形界面启动 VirtualBox 并创建新的虚拟机来测试其功能[^2]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值