VirtualBox 5.0 Installation on Fedora

Fedora doesn't have VirtualBox in its repositories. It can be installed either from RPM Fusion repository or from the official VirtualBox one. The second option is described in this document.

Created
2015
Updated
June 30, 2016

VirtualBox Repository

More info can be found on VirtualBox Download Page and VirtualBox User Manual.

Create a text file named virtualbox.repo in /etc/yum.repos.d/ directory with the repository specification.

$ cd /etc/yum.repos.d
$ sudo nano virtualbox.repo

Paste the following code.

[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc

Or just download the repo file into the directory.

# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -P /etc/yum.repos.d/

Installation

Now we can install VirtualBox from the new repository.

Pre-Installation

Install dkms package to ensure that the VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are properly updated if the linux kernel version changes during the next kernel update. Next we need kernel-headers package and kernel-devel package, otherwise the installation fails (more info in VirtualBox manual).

$ sudo dnf install dkms
$ sudo dnf install kernel-headers
$ sudo dnf install kernel-devel

Installation

Find the latest version of VirtualBox. Either from our repository or from the Downloads section on VirtualBox website.

$ sudo dnf search VirtualBox

Install the latest VirtualBox package (currently 5.0).

$ sudo dnf install VirtualBox-5.0

Needed kernel modules are build and vboxusers group is created during installation.

Sometimes it's useful to know how to rebuild kernel modules. There are four commands with the same effect, the first one is the official one.

# rcvboxdrv setup
# /usr/lib/virtualbox/vboxdrv.sh setup
# /etc/init.d/vboxdrv setup
# service vboxdrv setup

Add user to vboxusers group. The user must log out and then log back in.

# usermod -a -G vboxusers david

Post-Installation

Download VirtualBox Extension Pack from VirtualBox Downloads page. Install it in VirtualBox 'File' > 'Preferences...' > 'Extensions'