Install VirtualBox In Fedora/RHEL/CentOS Linux

how to install virtualbox in fedora or RHEL or CentOS

In this article, We’ll discuss how to install VirtualBox latest version on Linux distributions including Fedora, RHEL and CentOS. This will easily allow you to access more other operating systems via a virtualization platform.

VirtualBox is a well renowned tool and option for those who want a cross platform virtualization application that can allow them to use various operating systems on a single machine. This application is offered as an open source tool by Oracle, and includes a number of features which are as follows:

Easy to use: The VirtualBox is very lightweight and easy to install application. So the installation and its usage is quite simple. Still it offers a very powerful solution for users to virtualize their system easily.
Powerful: The app is powerful enough and supports Intel and AMD hardware, that allows to have fast execution and makes use of chip-level virtualization support. With the help of this application, a user can setup up to 32 vCPUs and have a wide range of storage controllers as well as asynchronous input and output virtual disk.
Control resources effectively: The VirtualBox allows users to control their resources more easily and efficiently. Means, the CPU execution, network I/O, disk read and write and other host resources can easily be throttled or capped as per the requirements. Even if the hackers manage to access your virtual machine, they won’t be able to access more than set resources.
Wide community support: Since the VirtualBox is being used on a very large scale and the app is available free for personal use, obviously if you need any kind of help, you can check out its official forum to search content for help.

Installing the latest VirtualBox on Fedora/RHEL/CentOS

Since the Virtualbox is technically available for cross platforms and support even Linux variants too, it can also be used on aforementioned OS variants. To install the latest version of this app in Linux distributions mentioned, follow the instructions discussed.

Install VirtualBox on Fedora Workstation

At first, download and configure the repository file and import the public key with the following commands here:

wget -P /etc/yum.repos.d/
rpm --import

Since the VirtualBox uses vboxdrv kernel module to control and allocate memory for execution of other operating systems, it’s necessary to install some dependency modules like DKMS, kernel-headers and kernel-devel and more. First update the system and install required dependencies with following commands:

dnf update
dnf install @development-tools
dnf install kernel-devel kernel-headers dkms qt5-qtx11extras elfutils-libelf-devel zlib-devel

Once the dependencies are installed, you can now install the latest version of virtualBox now with following command.

dnf install VirtualBox-6.1

Install VirtualBox on RHEL/CentOS

Run the commands here to download and configure Virtualbox.repo file and import the public key using rpm command:

wget -P /etc/yum.repos.d/
rpm --import

Next is to enable EPEL repository that’s necessary to install build tools and dependencies on the system. Run the command here to do so:

\** For CentOS/RHEL 8
# dnf install

\** For CentOS/RHEL 7
# yum install

\** For CentOS/RHEL 6
# yum install

After then, install the dependency packages required for VirtualBox with the command here:

\** For CentOS/RHEL 8
# dnf update
# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y

\** For CentOS/RHEL 6 and 7
# yum update
# yum install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y

Finally, you can install VirtualBox on system by running:

dnf install VirtualBox-6.1
yum install VirtualBox-6.1

So, you have successfully installed VirtualBox latest version on Fedora, CentOS and RHEL Linux distributions, and run the app to install other operating systems.

Launching VirtualBox in Linux

In order to start just installed software package on your Linux machine, launch the terminal and run the following command.


Troubleshooting issues while installing VirtualBox

While installing VirtualBox on a Linux machine, a user may end up to face some error messages too, in which some of them are here mentioned, also how to resolve them.

Case 1: “”This system is currently not set up to build kernel modules.
Please install the Linux kernel “header” files matching the current kernel””

Technically, the above error message indicates there’s a conflict between two kernel versions, and in order to resolve the issue, the users should check their installed kernel and update the Linux kernel too by running this command:

uname -r
dnf update kernel-*
yum update kernel-*

once done, it’s recommended to restart your Linux machine and choose the latest kernel from the boot menu. Usually, the first entry is the right selection. To reboot the machine, run:


After you login to your system once again, make sure that the kernel-devel version now matches with the Linux kernel too.

rpm -q kernel-devel
uname -r

After that, restart the build setup process and verify if the VirtualBox installation processed completely. You can run the following commands to do so:

systemctl status vboxdrv

Case 2: “”KERN_DIR”” of kernel source directory not detected or similar ones.

In this case, the the kernel source directory not gets detected by the build process, and to fix the issue, you need to set it using the following commands.

export KERN_DIR

Final Thoughts

VirtualBox is an open source virtualization software or application that allows to run more guest operating systems on a single machine. Also, the app is available for various cross platforms, and here this article discussed how to install VirtualBox on Fedora/RHEL/CentOS operating systems and fix some related issues easily. Do share this tutorial with your friends. If you have any question, you can click to Visit Our Discussion Board.