How to Install VirtualBox on Fedora Linux

Oracle 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
Windows 8
Windows 8.1
DOS
Linux (2.4, 2.6, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11)
Solaris
OpenSolaris
OpenBSD

This guide shows howto install VirtualBox using VirtualBox own yum repositories.

Change to root User

su

Install Fedora Repo File

cd /etc/yum.repos.d/

wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

Update latest packages and check your kernel version
Update packages

dnf update

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

rpm -qa kernel |sort -V |tail -n 1

uname -r

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

reboot

Install following dependency packages

dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

Install VirtualBox Latest Version 5.2

dnf install VirtualBox-5.2

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:

/usr/lib/virtualbox/vboxdrv.sh setup

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

Example:
My username is james

usermod -a -G vboxusers james

Start VirtualBox
Use launcher from menu or simply run:

VirtualBox
1

Thank you for reading.