VirtualBox is an open source cross-platform virtualization software that allows you to run multiple guest operating systems (virtual machines) at the same time.
VirtualBox provides a set of drivers and applications (VirtualBox Guest Additions) that can be installed on the guest operating system to enhance guest functionality such as shared folders, shared clipboard, mouse pointer integration, improved video support, and more.
This article explains how to install VirtualBox Guest Additions on CentOS 8 guests.
Installing Guest Additions on Guests on CentOS
VirtualBox comes with an ISO image file called “VBoxGuestAdditions.iso” which contains the guest addition installers for all supported guest operating systems. This file resides on the host machine and can be mounted on the guest machine using the VirtualBox GUI manager. Once installed, you can install the add-ons on the guest system.
Follow the instructions below to install VirtualBox Guest Additions on your desktop or CentOS 8 server.
- Open the VirtualBox GUI Manager.
- Start your CentOS guest virtual machine.
- Log into the guest machine as root or sudo and install the packages required to build kernel modules:
sudo dnf install gcc kernel-devel kernel-headers dkms make bzip2 perl
- From the virtual machine menu select Devices -> “Insert Guest Additions CD Image” as shown in the picture below:
If you get a message that there is no CD in the guest system, stop the virtual machine, open the machine settings. Go to the Storage tab and add a new CD-ROM drive by clicking on the plus sign (Adds optical device). Then reboot the virtual machine.
- Open your CentOS guest terminal, create a new directory and mount the ISO file:
sudo mkdir -p /mnt/cdrom sudo mount /dev/cdrom /mnt/cdrom
- Change to the newly created directory and run the VBoxLinuxAdditions.run script to start installing the Guest Additions:
cd /mnt/cdrom sudo sh ./VBoxLinuxAdditions.run --nox11
The –nox11 option tells the installer not to spawn the XTERM window.
The output will look like this:
Verifying archive integrity... All good. Uncompressing VirtualBox 6.0.16 Guest Additions for Linux........ ... ... VirtualBox Guest Additions: Starting.
- Reboot your CentOS guest for the changes to take effect:
sudo shutdown -r now
- After booting up the virtual machine, log into it and verify that the installation was successful and the kernel module was loaded using the lsmod command:
lsmod | grep vboxguest
The output will look something like this:
vboxguest 348160 2 vboxsf
If the command returns nothing, it means that the VirtualBox kernel module is not loaded.
That’s all. You have installed VirtualBox Guest Additions on your CentOS guest machine.
Now you can enable shared clipboard and Drag’n Drop support in the Storage tab of the virtual machine settings, enable 3D acceleration in the Display tab, create shared folders and much more.
Installing VirtualBox Guest Additions improves the performance of the virtual machine and improves its usability.
To learn more about Guest Additions, visit the official VirtualBox Guest Additions documentation page.
If you have any questions, please leave a comment below.