Follow through this tutorial to learn how to install VirtualBox guest additions on Oracle Linux 9. VirtualBox guest additions “consist of device drivers and system applications that optimize the guest operating system for better performance and usability“.
VirtualBox guest additions can only be installed after the OS has been installed on VirtualBox. In our previous guide, we learnt how to install Oracle Linux 9 on VirtualBox;
Install Oracle Linux 9 on VirtualBox
Installing VirtualBox Guest Additions on Oracle Linux
The Guest Additions offer the following features:
- Mouse pointer integration
- Shared folders for easy sharing of files between the host and the guest
- Ensures better and accelerated video performance.
- Seamless windows integration
- Generic host/guest communication channels that enables you to control and manage guest execution.
- Provides Host-Guest time synchronization.
- Shared clipboard between host and guest vm.
- Automated logins.
The features are extensively explained on the VirtualBox User Manual.
Install Kernel Headers on Oracle Linux 9
To install VirtualBox guest additions, you need to ensure that the Kernel headers are installed. There are other development tools required.
Thus, begin by install EPEL repository on Oracle Linux;
dnf install epel-release -y
Next, install the kernel headers and build tools by executing the command below;
dnf install dkms kernel-uek-devel gcc make bzip2 perl elfutils-libelf-devel
Next, ensure that the version of kernel-euk-devel installed does match the version of your running kernel. You can verify by running the commands below.
rpm -q kernel-uek-devel | uname -r |
kernel-uek-devel-5.15.0-1.43.4.2.el9uek.x86_64 | 5.15.0-1.43.4.2.el9uek.x86_64 |
Compare kernel version numbers
If they do not match, as shown in the outputs above, update your kernel by running;
sudo dnf update kernel-uek-* kernel-uek
Next, reboot the system and verify the kernel versions again. After the reboot, proceed with installation.
You can install VirtualBox guest additions via the command line or via GUI.
- Install VirtualBox guest additions ISO on Oracle Linux 9 via Command Line
- Install VirtualBox guest additions ISO on Oracle Linux by Inserting from VirtualBox Devices
Install VirtualBox guest additions via CLI
Confirm VirtualBox version on your host;
VBoxManage --version
Sample output;
6.1.38r153438
Download VirtualBox Guest Additions ISO file of the same version as your installed VirtualBox.
wget http://download.virtualbox.org/virtualbox/6.1.38/VBoxGuestAdditions_6.1.38.iso -P /tmp
Mount the guest addition iso under the /mnt
directory.
sudo mount /tmp/VBoxGuestAdditions_6.1.38.iso /mnt
Next, navigate to the mount directory and execute the Linux guest addition installer
cd /mnt
sudo ./VBoxLinuxAdditions.run
Or simply run;
sudo /mnt/VBoxLinuxAdditions.run
Sample installation output;
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.38 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.38 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel
5.15.0-1.43.4.2.el9uek.x86_64.
ValueError: File context for /opt/VBoxGuestAdditions-6.1.38/other/mount.vboxsf already defined
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
Install VirtualBox guest additions ISO Inserting from Devices Menu
To begin with, ensure the VM has an empty controller IDE optical drive.
Then, open the VM menu and navigate to Devices > Insert Guest Additions CD Image…
Next, mount the Guest Additions;
sudo mount /dev/cdrom /mnt/
Then install VirtualBox guest additions:
sudo /mnt/VBoxLinuxAdditions.run
Reboot Oracle Linux 9
After the installation is done, reboot the system to effect the changes;
sudo systemctl reboot -i
First thing after the system boots, after you login, it should auto-resize and set screen to full-screen.
If the system do not auto-resize the screen, toggle it on the VM menu by clicking View > Auto-resize Guest Display. This can only be done after login.
And that is it on how to install VirtualBox guest additions on Oracle Linux 9. You can now enable other features such as shared clipboard, drag and drop between the host and virtual machine.