virtualbox-logo-small

Oracle VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use.

Support inttf:

Buy Me a Coffee:

This guide shows howto install VirtualBox 7.2 (currently 7.2.6) on Red Hat Enterprise Linux (RHEL) 10.x / 9.x / 8.x, CentOS Stream 10 / 9 / 8, Rocky Linux 10 / 9 / 8, and Alma Linux 10 / 9 / 8 using Oracle’s own yum/dnf repo.

1. Install Oracle’s VirtualBox 7.2.6 on RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 (Oracle repo)

This guide works with UEFI Secure Boot disabled or enabled. If you keep Secure Boot enabled, follow this step-by-step module signing guide:

RHEL Secure Boot: Howto sign VirtualBox kernel modules (DKMS + .run installer)

1.1. Change to root user

su -
## OR ##
sudo -i

1.2. Download Oracle VirtualBox repo file

cd /etc/yum.repos.d/

## Download VirtualBox repo file ##
wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

1.3. Update latest packages and check your kernel version

dnf update

Reboot if you updated kernel and other important packages. Check your current kernel version:

uname -r

1.4. Install needed packages

## RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 ##
dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms

1.5. Disable UEFI Secure Boot or Check Howto Sign VirtualBox Kernel Modules

Check is UEFI Secure Boot Enabled or Disabled

mokutil --sb-state

This guide works with UEFI Secure Boot disabled or enabled.

  • If you prefer the simple path, disable Secure Boot.
  • If you want to keep Secure Boot enabled, you must sign the VirtualBox kernel modules. Follow this step-by-step module signing guide:

RHEL Secure Boot: Howto sign VirtualBox kernel modules (DKMS + .run installer)

1.6. Install VirtualBox Latest Version 7.2 (currently 7.2.6)

dnf install VirtualBox-7.2

This command create automatically vboxusers group and VirtualBox user must be member of that group.
This command also builds needed kernel modules.
Package is VirtualBox-7.2 not VirtualBox.

Rebuild kernel modules with following command:

Secure Boot disabled

## RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 ##
/usr/lib/virtualbox/vboxdrv.sh setup

## Alternative (same thing on many installs) ##
/sbin/vboxconfig

Secure Boot enabled

If you have UEFI Secure Boot enabled with custom module signing keys (from Page 2):

## First, rebuild modules without signing ##
/usr/lib/virtualbox/vboxdrv.sh setup
## OR ##
/sbin/vboxconfig

## Then manually sign the rebuilt modules ##
KERNELVER=$(uname -r)
SIGNFILE=/usr/src/kernels/${KERNELVER}/scripts/sign-file

for m in vboxdrv vboxnetflt vboxnetadp vboxpci; do
    modpath=$(modinfo -F filename "$m" 2>/dev/null || echo "")
    if [ -n "$modpath" ]; then
        echo "Signing $m -> $modpath"
        ${SIGNFILE} sha256 /root/module-signing/MOK-vbox.priv /root/module-signing/MOK-vbox.der "$modpath"
    fi
done

## Rebuild module dependencies ##
depmod -a

1.7. Add VirtualBox User(s) to vboxusers Group

Replace user_name with your own user name or some another real user name.

usermod -a -G vboxusers user_name

1.8. Start VirtualBox

Use launcher from menu or simply run VirtualBox as normal user:

VirtualBox

2. Install Oracle’s VirtualBox 7.2.x on RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 using .run installer

Here is guide howto download and install VirtualBox using .run installer.

Note: Start this with fully updated system and using latest kernel version. Check step 1.3 Update latest packages and check your kernel version This guide works with UEFI Secure Boot disabled or enabled. If you keep Secure Boot enabled, follow this step-by-step module signing guide:

RHEL Secure Boot: Howto sign VirtualBox kernel modules (DKMS + .run installer)

2.1. Change to root User

su -
## OR ##
sudo -i

2.2. Remove VirtualBox RPM Installations

This should not touch (remove) your virtual machines, but you can of course backup everything.

dnf remove VirtualBox\* virtualbox

2.3. Download VirtualBox 7.2/7.1 Installer

cd ~

## Download VirtualBox 7.2.6-172322 latest stable build ##
wget https://download.virtualbox.org/virtualbox/7.2.6/VirtualBox-7.2.6-172322-Linux_amd64.run

## Download VirtualBox 7.1.x-172119 test build ##
wget https://www.virtualbox.org/download/testcase/VirtualBox-7.1.x-172119-Linux_amd64.run

## Download VirtualBox 7.2.x-172125 test build ##
wget https://www.virtualbox.org/download/testcase/VirtualBox-7.2.x-172125-Linux_amd64.run

## Download VirtualBox development snapshot ##
wget https://www.virtualbox.org/download/testcase/VirtualBox-development-172124-Linux_amd64.run

Check current versions from VirtualBox Linux builds and VirtualBox test builds.

2.4. Make Installer File Executable

chmod +x VirtualBox-7.2.6-172322-Linux_amd64.run

## OR ##

chmod +x VirtualBox-7.1.x-172119-Linux_amd64.run

## OR ##

chmod +x VirtualBox-7.2.x-172125-Linux_amd64.run

## OR ##

chmod +x VirtualBox-development-172124-Linux_amd64.run

2.5. Install Following Dependency Packages

## RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 ##
dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms

2.6. Install VirtualBox

./VirtualBox-7.2.6-172322-Linux_amd64.run

## OR ##

./VirtualBox-7.1.x-172119-Linux_amd64.run

## OR ##

./VirtualBox-7.2.x-172125-Linux_amd64.run

## OR ##

./VirtualBox-development-172124-Linux_amd64.run

Rebuild kernel modules with following command:

Secure Boot disabled

## RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 ##
/usr/lib/virtualbox/vboxdrv.sh setup

## Alternative (same thing on many installs) ##
/sbin/vboxconfig

Secure Boot enabled

If you have UEFI Secure Boot enabled with custom module signing keys (from Page 2):

## First, rebuild modules without signing ##
/usr/lib/virtualbox/vboxdrv.sh setup
## OR ##
/sbin/vboxconfig

## Then manually sign the rebuilt modules ##
KERNELVER=$(uname -r)
SIGNFILE=/usr/src/kernels/${KERNELVER}/scripts/sign-file

for m in vboxdrv vboxnetflt vboxnetadp vboxpci; do
    modpath=$(modinfo -F filename "$m" 2>/dev/null || echo "")
    if [ -n "$modpath" ]; then
        echo "Signing $m -> $modpath"
        ${SIGNFILE} sha256 /root/module-signing/MOK-vbox.priv /root/module-signing/MOK-vbox.der "$modpath"
    fi
done

## Rebuild module dependencies ##
depmod -a

2.7. Add VirtualBox User(s) to vboxusers Group

Replace user_name with your own user name or some another real user name.

usermod -a -G vboxusers user_name

2.8. Start VirtualBox

Use launcher from menu or simply run VirtualBox as normal user:

VirtualBox

DKMS build your kernel modules automatically, but if you want upgrade your VirtualBox installation, then close VirtualBox, download new installer, make it executable and install it.

3. Troubleshooting

3.1 UEFI Secure Boot

If you have Secure Boot enabled, VirtualBox kernel modules may not load unless you sign them or disable Secure Boot.

To keep Secure Boot enabled and use VirtualBox, follow the module signing guide:

RHEL Secure Boot: Howto sign VirtualBox kernel modules (DKMS + .run installer)

3.2 KERN_DIR parameter

If you have problems with KERN_DIR parameter or your kernel directory is not automatically detected then set KERN_DIR environment variable manually, using following method:

## Current running kernel on RHEL / CentOS / Rocky Linux / Alma Linux 10 / 9 / 8 ##
export KERN_DIR=/usr/src/kernels/$(uname -r)

Check also:

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