The most simple way to install VirtualBox Guest additions in Fedora and related distros.
When you install Linux on a virtual machine, it is often designated by the guest system. And the host system is where you install the VirtualBox application.
Oracle’s VirtualBox provides a set of device drivers and apps which helps to achieve data and other communication between guest and host system. For example, if you want to share folders, drag and drop a from from host to guest and so on. Here’s some of the cool features of Guest Additions.
- Share folders
- Drag and drop feature
- Bi-directional clipboard to achieve seamless cut/copy & paste
- Better video performance
After you install VirtualBox in Fedora, RHEL or CentOS, you should definitely install Guest Additions. Here’s how.
Installing VirtualBox Guest Additions on Fedora (with RHEL, CentOS, etc.)
These instructions assume that you have installed a guest Fedora system in VirtualBox.
- Open VirtualBox in the host system and start Fedora virtual machine.
- After boot up is complete, go to the VirtualBox menu and select
Devices > Insert Guest Additions CD Image. Here’s an example image for your reference.
- Once you do that, you should see a new disk mounted under
/run/media/[user name]/directory. Go to that directory from the terminal.
cd /run/media/[user name]/VBox_GA_6.1.38
- Then execute the setup program VBoxLinuxAdditions using the below command.
Wait for the instructions to finish. Once done, you should see the options available for Copy/Paste, folder share and others, as shown below.
- Fixing “Kernel Headers not found for target Kernel” error
- The above method will work when your guest and host – both Kernel version is the same. But if your guest machine’s Kernel version differs from the host machine, you may get the error “Kernel Headers not found for target Kernel”.
- To solve this, you must install the Kernel build helper packages in the guest system. So, to do that, open a terminal in the guest system and run the following commands.
sudo dnf install kernel-devel kernel-headers
- After rebooting, follow the above steps again to install the VirtualBox.
In this tutorial, I have shown you how easily you can install guest additions in Fedora and other related distros. For Ubuntu, the instructions should be the same.
This article is tested in Fedora 36 and Fedora 37, although it should work just fine for other versions/distros.
Finally, let me know in the comment box if you face any errors while installing it.