Oracle Corporation Team has released its new major version VirtualBox 6.1.32 on Jan 18, 2022. In this release VirtualBox has improves stability and fixes regressions. To read more about this release read changelog.
This tutorial will help you to install Oracle VirtualBox 6.1 on Fedora 35/34/33/32/31/30 Linux systems using DNF.
Step 1 – Prerequisites
First of all, You need to configure the yum repository to install Virtualbox on your Fedora system. You can simply download the repo file from its official site and place it under at /etc/yum.repos.d/virtualbox.repo. Navigate to /etc/yum.repos.d directory and use one of the below commands as per your operating system.
cd /etc/yum.repos.d/ sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
Before installing VirtualBox make sure to install all required packages to run VirtualBox like kernel-headers, kernel-devels, etc. Use the following command to install the required packages.
sudo dnf install binutils gcc make patch libgomp dkms qt5-qtx11extras libxkbcommon sudo dnf install glibc-headers glibc-devel kernel-headers kernel-devel compat-libvpx5
After installing the latest kernel and kernel headers, let’s reboot your system and start with the Latest kernel.
sudo reboot
Step 2 – Configure Environment
VirtualBox installation required kernel source code to install required modules, So we need to configure environment variable KERN_DIR to which VirtualBox get kernel source code. In my case latest kernel source is available in 4.16.5-300.fc28.x86_64 directory under /usr/src/kernels/ . Make sure you are using correct source path.
export KERN_DIR=/usr/src/kernels/`uname -r`
echo $KERN_DIR /usr/src/kernels/4.16.5-300.fc28.x86_64
Step 3 – Install VirtualBox on Fedora
Use the following command to install VirtualBox using the DNF command-line tool. It will install the latest version of VirtualBox on your Fedora system.
sudo dnf install VirtualBox-6.1
After installation, we need to rebuild kernel modules using the following command.
sudo /usr/lib/virtualbox/vboxdrv.sh setup
Step 4 – Launch VirtualBox
You can use the application launcher or use the following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.
virtualbox
Conclusion
In this tutorial, you have learned to install VirtualBox on the Fedora system. Now, you can create virtual machines for operating systems of your choice and work on them.
12 Comments
Very straight forward and helpful. Thank you for posting.
thanks rahul..its very helpfully for me
Hi Rahul,
I really appreciate your article, it helped me a lot. Please, update the end where you said to run “/usr/lib/virtualbox/vboxdrv.sh setup”, befor it, the secure boot must be disabled on BIOS, and this command must run as root (sudo). Thank you very much!
Note: Tested in fedora32 workstation and worked pretty good following those instructions above.
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is probably not loaded.You may not have kernel driver installed for kernel that is runnig, if so you may do as root: dnf install akmod-VirtualBox kernel-devel-$(uname -r)If you installed VirtualBox packages and don’t want reboot the system, you may need load the kernel driver, doing as root: akmods; systemctl restart vboxdrv.service
If your system has EFI Secure Boot enabled you may also need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system’s documentation for more information.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) – The support driver is not installed. On linux, open returned ENOENT.
no such file as /usr/lib/virtualbox/vboxdrv.sh
Hi, it doesn’t work at Fedora 31 . after this sudo /usr/lib/virtualbox/vboxdrv.sh setup it display — vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel “header” files matching the current kernel
for adding new hardware support to the system.
If i type uname -r it shows 5.4.13-201.fc31.x86_64
but it created the folders /usr/src/kernels/ 5.5.5-200.fc31.x86_64 . how to handle the isue ? . Thanks a lot !!
Thank you.
Just wanted to update this a bit for Fedora 30 users.
1. The libvpx4 prerequisite is no longer available for Fedora 30 in the repositories this guide uses. Instead switch it to compat-libvpx5.
2. In order to run ‘ /usr/lib/virtualbox/vboxdrv.sh setup ‘, you need to have root privileges and have Secure Boot disabled in your BIOS. Try running ‘ /usr/lib/virtualbox/vboxdrv.sh setup ‘ again and they will tell you which addition kernels to install based on your kernel in order for VirtualBox to run. Just copy paste and run them, there are 2.
If I’m not wrong then the libvpx prerequisite is no longer available for fedora 30 in the repositories this guide uses
compat-libvpx5 is the correct one
Thank you. You are right. compat-libvpx4 wasn’t available in the repo. compat-libvpx5 worked
Thank you very much!
/usr/lib/virtualbox/vboxdrv.sh setup this command required root privileges.