install oracle virtualbox on fedora
How to install Oracle VirtualBox on Fedora Linux
1
Install Build Tools and Kernel Headers (Crucial) ⚠️
VirtualBox needs to build a kernel module (vboxdrv) that works with your specific kernel version. To do this, you must first install the necessary development tools and headers.
Update Your System: First, make sure your system is fully up-to-date.
sudo dnf update
Reboot: After updating, especially if there was a kernel update, restart your computer to ensure you're running the latest kernel.
Install Prerequisites: Open a terminal and install the tools. Using $(uname -r) ensures you get the headers for your currently running kernel.
sudo dnf install kernel-devel kernel-headers dkms gcc make perl elfutils-libelf-devel
kernel-devel / headers: The source files for your kernel.
gcc / make: The compiler and build tools.
dkms: This is highly recommended. It automatically rebuilds the VirtualBox kernel modules whenever your system's kernel is updated, which saves you a lot of trouble.
2
Add the Official VirtualBox Repository
Next, you'll add Oracle's official repository so your system knows where to download VirtualBox from.
Download the repository file: This command downloads the repo file from Oracle and places it in the correct system directory.
sudo wget https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -P /etc/yum.repos.d/
3
Install VirtualBox
Now you can install VirtualBox using the dnf package manager.
Find the Latest Version: You can see which versions are available. The package is named VirtualBox-7.0, for example.
dnf search VirtualBox
Install the Package: Install the latest version you found in the previous step (e.g., VirtualBox-7.0).
sudo dnf install VirtualBox-7.0
The installation process will trigger dkms to build the vboxdrv kernel module for you.
4
Add Your User to the vboxusers Group
To access USB devices from inside your virtual machines, you must add your user account to the vboxusers group.
Run the command: Replace your_username with your actual username, or just use the $USER variable which does it automatically.
sudo usermod -aG vboxusers $USER
Apply the Change: You need to log out and log back in for this group change to take effect.
5
Install the Extension Pack (Recommended) ✨
The VirtualBox Extension Pack is a separate download that enables extra features like support for USB 2.0/3.0 devices, webcam passthrough, and disk encryption.
Check Your Version: In the VirtualBox app, go to Help > About VirtualBox to see your exact version (e.g., 7.0.18).
Download the Correct Pack: Go to the official VirtualBox downloads page. Download the Extension Pack that exactly matches your installed VirtualBox version.
Install the Pack: Once downloaded, double-click the .vbox-extpack file.
VirtualBox will open and prompt you to install it. Click Install and follow the on-screen instructions. Your official VirtualBox installation is now complete and ready to use.
Gnome Boxes conflict
If you have Gnome Boxes installed, then it's very possible that you will get an error message when you try to install a new VirtualBox machine.
VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernal and reboot
Your computer's processor has special hardware for virtualization, but only one program can control it at a time. GNOME Boxes uses Linux's native virtualization technology, called KVM (Kernel-based Virtual Machine). VirtualBox uses its own driver, called vboxdrv. When you boot your Fedora system, the KVM module often loads automatically (especially if you've run Boxes before), grabbing control of the virtualization hardware. When you then try to start a VirtualBox VM, it finds that KVM is already in charge and produces the exact error you're seeing.
If VirtualBox will be your primary tool, you can prevent the KVM service (libvirtd) from starting at boot. This ensures VirtualBox always has access to the hardware. Run these commands in the terminal one at a time
sudo rmmod kvm_intel
sudo modprobe vboxdrv
sudo systemctl disable --now libvirtd
This command stops the service that manages KVM and prevents it from starting on the next reboot. VirtualBox will now work without conflict. The trade-off is tht GNOME Boxes will no longer function until you re-enable the service with
sudo systemctl enable --now libvirtd
Last modified: August 6th, 2025