您的位置:首页 > 运维架构 > Linux

CentOS 7 安装VirtualBox

2017-02-16 14:04 369 查看

 

VirtualBox 5.1 Released – Install on RHEL/CentOS/Fedora and Debian/Ubuntu/Linux Mint

  导入epel安装源 
#yum  install epel-release

在 RHEL/CentOS 和 Fedora 上安装 VirtualBox 5.1

1.如果已经安装有老版本,需要先卸载原来版本

# yum remove VirtualBox-4*

 2.添加VirtualBox安装源

 RHEL/CentOS 7/6/5
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo 
RHEL/CentOS 5
# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm
Fedora 24-12
# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

3.安装相关依赖包

# yum update
# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

4.安装VirtualBox 5.1

# yum install VirtualBox-5.1

 5.重建VirtualBox 5.1内核模块

------------- Fedora 24-19 and CentOS/RHEL 7 -------------
#/usr/lib/virtualbox/vboxdrv.sh setup

 

------------- Fedora 18-16 and CentOS/RHEL 6/5 -------------
#/etc/init.d/vboxdrv setup

 

## OR ##
#service vboxdrv setup

 6.添加用户到vboxusers中 (user_name替换为相应的用户名)

# usermod -a -G vboxusers user_name

7.如果有关于KERN_DIR的错误,则需要设置相应的全局变量

## RHEL / CentOS / Fedora ##
KERN_DIR=/usr/src/kernels/3.10.0-229.7.2.el7.x86_64
## Export KERN_DIR ##
export KERN_DIR

 

Installing VirtualBox 5.1 in Debian, Ubuntu and Linux Mint

First, uninstall any earlier version of Virtualbox if any.

$ sudo apt-get remove virtualbox-4*

Next, install latest 5.1 version using official Virtualbox repository. To add the repository, use the following command as shown.

$ sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install virtualbox-5.1

Starting VirtualBox 5.1

Simply execute following command to start it from the terminal or use launcher from menu to start.

# VirtualBox
VirtualBox Screenshots on CentOS 7

VirtualBox 5.0 on CentOS 7

Create New Guest OS

Guest OS Settings

VirtualBox Screenshots on Linux Mint 17

Virtualbox 4.3 Preview

Virtualbox Video Capture Support

Virtualbox 4.3 Running VM’s

Installing VirtualBox Extension Pack

If you need some additional functionality such as VirtualBox RDP, PXE, ROM with E1000 support and USB 2.0 Host Controller support, etc. You need to download and install the VirtualBox Extension Pack using following wget command.

# wget http://download.virtualbox.org/virtualbox/5.1.0/Oracle_VM_VirtualBox_Extension_Pack-5.1.0.vbox-extpack

To install the extension pack, you must have Virtualbox 5.1 installed, once you downloaded vbox-extpack open with Virtualbox as shown below. If it doesn’t work out, then open Virtaulbox –> Preferences –> Extensions and browse for the vbox-extpack to install it.

Install VirtualBox Extension Pack

VirtualBox Extension Pack

Updating VirtualBox

If you want to update the VirtualBox with latest version in the future, you can simply run the following command to update it.

On RHEL/CentOS/Fedora
# yum update VirtualBox-5.1
On Ubuntu/Linux Mint
# apt-get install VirtualBox-5.1

Remove VirtualBox

If in case you want to remove VirtualBox completely, just use the following command to remove it completely from your system.

On RHEL/CentOS/Fedora
# cd /etc/yum.repos.d/
# rm -rf virtualbox.repo
# yum remove VirtualBox-5.1
On Ubuntu/Linux Mint
# apt-get remove VirtualBox-5.1

You can also Download VirtualBox 5.1 for other Linux, Windows and Mac OS X platforms.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: