in Linux

How to install VirtualBox on Fedora 23

VirtualBox is probably the most popular visualization product ever. It’s free, open-source and cross-platform. I used VirtualBox on plenty of operating systems such as Windows, Mac, and Ubuntu Linux and was very satisfied.

Linux distros such as Ubuntu, Debian, etc. prefer to be more stable rather than being up-to-date while, on the other hand, distros like Fedora, Arch, etc. are always running the latest version of Kernel. For apps like VirtualBox, that need to install a kernel driver alongside the app, being compatible with always-up-to-date distros is such a difficult work. It’s not as easy as a sudo apt install VirtualBox. In this post I am going to show how you can install the latest version of VirtualBox on Fedora 23.

I always keep my machines OSs up to date. My Linux machine which has a Fedora 23 complies the same rule. The Kernel version on it is 4.3.5 (The latest Fedora update to date) and VirtualBox doesn’t offer a driver for this specific version; so, lets see how we can Install and run a virtual machine on it.

By default, Fedora dnf/yum repositories don’t have VirtualBox; therefore, you need to add it manually:

Create a file name virtualbox.repo in the /etc/yum.repos.d/virtualbox.repo and add the following lines in it:

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

Then simply do a sudo dnf check-update to update the repository cache and check for updates.

After that, Install VirtualBox using the following command:

sudo dnf install VirtualBox kmod-VirtualBox-5.0.14-1.fc23.x86_64 kmod-VirtualBox

Note: At the time of writing this post, VirtualBox 5.0.14 is the latest version.

In addition to that, you need to install the kernel headers so you can compile the VirtualBox kernel driver:

sudo dnf install kernel-devel-$(uname -r)

This will install the appropriate kernel header according to your current kernel version.

Now you need to compile the kernel driver. To do that, simple run the following command:

sudo akmods

Akmods checks the akmod packages and rebuilds them if needed.
Restart you computer, run the VirtualBox and you’re done 🙂