A simple and easy-to-follow guide on how you can install Oracle VirtualBox in Fedora Linux.
VirtualBox is an Oracle application that helps you create virtual machines for any operations system. It’s a little more advanced and brings several features, such as networking, USB, NVMe support, etc., between guest and host systems.
Although, there are other free and open-source virtual machines available, such as virt-manager or GNOME Boxes. And they are simple to install and use. But in this guide, I will talk about how to install Oracle’s VirtualBox, which many want to try out.
Let’s begin.
Install Oracle VirtualBox in Fedora
This guide was tested on Fedora 36 and Fedora 37. However, it should apply to all Fedora releases.
- In your Fedora system, open a terminal and install kernel-headers and dkms, which are needed for VirtualBox setup.
sudo dnf install glibc-headers glibc-devel kernel-headers kernel-devel dkms
- Once installation is finished, set the KERN_DIR variable with the Kernel installed in your system.
export KERN_DIR=/usr/src/kernels/'uname -r'
- After you run the above command, you should check if the latest Kernel is showing up using the below command:
echo $KERN_DIR
- Restart your system.
- After restart, go to the below link for Linux and download the RPM version under Fedora (choose the highest Fedora version; For example, Fedora 36 or 37 – whichever is available).
- After downloading, go to the download directory and install the RPM package. Make sure to change the file name accordingly to your downloaded file.
cd ~/Downloads
sudo dnf install VirtualBox-7.0-<version>.rpm
- After the download is complete, run the setup using the following command. This command will start the VirtualBox Systemd service and build the Kernel modules using the packages you installed in the first step above.
sudo /usr/lib/virtualbox/vboxdrv.sh setup
- Once done, open VirtualBox from the application menu.
Uninstall, re-install and upgrade
If you want to uninstall and reinstall, then you can run the following command to uninstall. Make sure to change the version accordingly in the below command.
In addition, if you want to upgrade to the latest version, you must uninstall it first. Then re-install using the above methods with a fresh download. All your created VM and its data are kept during the upgrade. So, you can get all of your VMs created in the prior version. Ideally, they are kept at ~./VirtualBox VMs
in your home directory.
sudo dnf remove VirtualBox-7.0
Wrapping up
Here in this guide, you learned how you could easily install Oracle VirtualBox in Fedora Linux (all versions). Stay tuned for the following articles.