VirtualBox Guest Additions improve the performance and integration of virtual machines running on CentOS, Red Hat, and Fedora. They provide features such as better screen resolution, shared clipboard, and folder sharing between the host and the virtual machine. Installing Guest Additions requires the system to have certain dependencies like kernel headers and development tools.
To install Guest Additions, the kernel headers must match the running kernel to avoid compatibility issues. The installation is done using a CD image that comes with VirtualBox. Once installed, these additions optimize the interaction between the host and the virtual machine, enhancing the user experience.
The process involves updating the system, installing necessary tools, mounting the Guest Additions ISO, and running the installation script. After installation, the virtual machine needs to be rebooted to apply the changes and ensure the enhancements are fully operational.
$ sudo dnf update
For older versions of CentOS or Red Hat, use yum instead of dnf.
$ sudo dnf install gcc make perl kernel-devel kernel-headers
Ensure that the installed kernel-devel matches the running kernel. Verify with the following command:
$ uname -r
$ sudo reboot
In the VirtualBox window, go to Devices → Insert Guest Additions CD Image.
$ sudo mkdir /mnt/cdrom $ sudo mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom $ sudo ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 7.0.0 Guest Additions for Linux........ Building the VirtualBox Guest Additions kernel modules...
Ensure there are no errors during this step. If kernel version mismatches, install the correct version and reboot.
$ lsmod | grep vbox vboxguest 45056 2 vboxsf 45056 1 vboxvideo 45056 1
$ sudo reboot