In the previous posts we saw how to install Oracle Linux 8.5 in a VirtualBox VM and the end user initial setup after the first connection. We are now going to see how to install the VirtualBox Guest Additions in order to allow a smooth integration with the host computer.

VirtualBox Guest Additions are not mandatory in order to use a Virtual Machine but they allow a smooth integration of the mouse, keyboard and to copy/paste text for instance between the host and guest systems. It is therefore a good idea to install them after a fresh installation of an operating system in a VM. So let’s see how to do it with an Oracle Linux 8.5 guest VM.
I was already connected to the VM as oracle so I selected the “Devices > Insert Guest Additions CD image…” VirtualBox menu.

Oracle Linux recognised the CD and asked me the permission to start the software it contained:

I clicked the “Run” button and I was asked by the system to authenticate to execute the software as super user:

I did it and the VirtualBox Guest Additions installation started in a new shell window:

But after a few seconds I get the dreaded “Kernel headers not found error for target kernel” error message:

The solution was therefore to install the missing target kernel headers.
First, I updated the list of packages using the “sudo yum update” command. There was nothing to update here because I had already updated the package list before trying to install the VirtualBox Guest Additions, but I have included the step anyway because you may need to execute this command before installing the package containing the current Linux kernel headers.

Later I checked what was the VM current Linux kernel version with the command “uname -r”:

The “uek” part in the the Linux kernel version identified that it was an “Unbreakable Enterprise Kernel (UEK)” built by Oracle and supported through Oracle Linux support. Therefore I needed to install the corresponding kernel header package.
I asked for a list of kernel related packages using the “yum list kernel*” command:

There were many kernel packages available and the one that I was looking for was “kernel-uek-devel.x86_64”:

I used the “sudo yum install kernel-uek-devel.x86_64″ command to install this package. It detected that the “binutils-devel” package needed to be installed too and asked for a confirmation.

I confirmed it with “y” and the two packages were downloaded and installed successfully:

I removed the VirtualBox Guest Additions CD from the virtual drive using the VirtualBox menu:

I reinserted the CD image:

And tried to install the VirtualBox Guest Additions again:


This time, the kernel modules were build without any issues and everything was installed correctly (the error message on the following screenshot had no consequences for the installation).

The VirtualBox Guest Additions were now installed and the mouse and keyboard interaction between the host and guest operating systems was now working smoothly!
It was now time to shutdown the VM and to backup the VM image just in case. But that’s something that we will see in an other post.
Disclaimer
The post How to install VirtualBox Guest Additions on Oracle Linux 8.5 VM appeared first on MyBIJourney