virtualbox-logo-small

This is guide, howto install Oracle VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL).

This guide should work with Fedora 38/37/36, CentOS 9/8/7, Red Hat (RHEL) 9/8/7.

VirtualBox Guest Additions is a special software that can be installed inside Linux virtual machines to improve performance and make integration much more seamless. Among the features provided by these VirtualBox Guest Additions are mouse pointer integration and arbitrary screen solutions (e.g. by resizing the guest window).

Check video version of guide:

Note: Fedora 38/37/36 have build in VirtualBox Guest Additions, but if you still wan’t (some reason) install latest/development/different version of GA, then you can use this guide.

1. Install VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL)

1.1 Change root user

su -
## OR ##
sudo -i

1.2 Make sure that you are running latest kernel

Update virtual machine kernel and reboot

## Fedora 38/37/36 and CentOS 9/8 / RHEL 9/8 ##
dnf update kernel*

reboot

1.3 Mount VirtualBox Guest Additions

Click Devices > Install Guest Additions… on VirtualBox
VirtualBox Install Guest Additions

Note: Some cases you might need Guest Additions Test Build ISO from here. Next shutdown your virtual machine attach this iso and boot. Then continue next step.

Mount VirtualBox Guest Additions device

mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions

1.4 Install following packages

On CentOS/Red Hat (RHEL) 9/8/7, EPEL repo is needed

## CentOS 9 and Red Hat (RHEL) 9 ##
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

## CentOS 8 and Red Hat (RHEL) 8 ##
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

## CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install following packages

## Fedora 38/37/36 ##
dnf install gcc kernel-devel kernel-headers dkms make bzip2 perl libxcrypt-compat

## CentOS/RHEL 9/8/7 ##
yum install gcc kernel-devel kernel-headers dkms make bzip2 perl

1.5 Add KERN_DIR environment variable

## Current running kernel on Fedora 38/37/36, CentOS 9/8/7 and Red Hat (RHEL) 9/8/7 ##
KERN_DIR=/usr/src/kernels/`uname -r`

## Fedora example ##
KERN_DIR=/usr/src/kernels/6.3.1-300.fc38.x86_64

## CentOS and Red Hat (RHEL) example ##
KERN_DIR=/usr/src/kernels/3.10.0-693.17.1.el7-x86_64

## Export KERN_DIR ##
export KERN_DIR

1.6 Install Guest Additions

cd /media/VirtualBoxGuestAdditions

# Then run following command
./VBoxLinuxAdditions.run

Output looks like following:

[root@fedora VBoxGuestAdditions]# ./VBoxLinuxAdditions.run 
Verifying archive integrity... All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 7.0.8 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.  This may take a while.
VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
VirtualBox Guest Additions: Starting.

1.7 Reboot guest system

reboot

Then VirtualBox Guest Additions install is ready.

Check also:

Install VirtualBox (with dnf) on Fedora, CentOS, Red Hat (RHEL)