VirtualBox is a free, open source Type 2 hypervisor from Oracle that lets you run multiple guest operating systems on a single physical machine. It supports x86 and AMD64/Intel64 architectures, making it a solid choice for development labs, testing environments, and running isolated workloads on your workstation.

This guide walks through installing VirtualBox 7.1 on Rocky Linux 10 / AlmaLinux 10, building kernel modules, installing the Extension Pack, creating VMs through both the GUI and CLI, setting up guest additions, networking, USB passthrough, headless operation, and the phpVirtualBox web interface. Every command is tested against an EL10 system.

Prerequisites

  • A server or workstation running Rocky Linux 10 or AlmaLinux 10 (64-bit x86_64)
  • Root or sudo access
  • Hardware virtualization enabled in BIOS/UEFI (Intel VT-x or AMD-V)
  • At least 4 GB RAM (8 GB+ recommended for running multiple VMs)
  • Stable internet connection for downloading packages
  • Desktop environment installed if you plan to use the VirtualBox GUI

Verify that your CPU supports hardware virtualization.

$ lscpu | grep Virtualization
Virtualization:                  VT-x

If nothing is returned, enable VT-x or AMD-V in your BIOS/UEFI settings and try again.

Step 1: Update System and Install Required Packages

Start by updating all packages to the latest versions and installing the development tools that VirtualBox needs to build its kernel modules.

sudo dnf update -y
sudo reboot

After the reboot, install the required build dependencies.

sudo dnf install gcc make perl kernel-devel kernel-headers elfutils-libelf-devel bzip2 -y

These packages provide the compiler toolchain, Perl interpreter, and kernel headers needed for building the vboxdrv kernel module. Confirm the kernel-devel version matches your running kernel.

$ rpm -q kernel-devel
kernel-devel-5.14.0-503.40.1.el10_0.x86_64

$ uname -r
5.14.0-503.40.1.el10_0.x86_64

Both versions must match. If they differ, reboot into the latest kernel first, then reinstall kernel-devel.

Step 2: Add the Oracle VirtualBox Repository

VirtualBox is not available in the default Rocky Linux or AlmaLinux repositories. Add Oracle’s official repo for EL-based distributions.

sudo dnf install epel-release -y

Now add the VirtualBox repository.

sudo dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

Import the Oracle GPG key to verify package integrity.

sudo rpm --import https://www.virtualbox.org/download/oracle_vbox_2016.asc

Verify the repository is active.

$ dnf repolist | grep -i virtualbox
virtualbox       Oracle Linux / RHEL / CentOS-10 / x86_64 - VirtualBox

Step 3: Install VirtualBox 7.1 on Rocky Linux 10 / AlmaLinux 10

Search for available VirtualBox versions to confirm 7.1 is in the repo.

$ dnf search virtualbox
====================== Name & Summary Matched: virtualbox ======================
VirtualBox-7.0.x86_64 : Oracle VM VirtualBox
VirtualBox-7.1.x86_64 : Oracle VM VirtualBox

Install VirtualBox 7.1.

sudo dnf install VirtualBox-7.1 -y

The installer pulls in all required dependencies including libSDL, libvpx, and the Qt libraries for the GUI. Verify the installation.

$ vboxmanage --version
7.1.6r167084

Step 4: Build Kernel Modules (vboxdrv)

VirtualBox relies on the vboxdrv kernel module to interface with the host kernel. Run the VirtualBox setup script to build and load the module.

$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.

Confirm the module is loaded.

$ lsmod | grep vboxdrv
vboxdrv               667648  3 vboxnetadp,vboxnetflt

If you see output like the above, the kernel module is running. If the build fails, check that kernel-devel matches your running kernel version exactly.

Step 5: Add Your User to the vboxusers Group

Only members of the vboxusers group can use VirtualBox features like USB passthrough and host-only networking. Add your user to the group.

sudo usermod -aG vboxusers $USER

Log out and log back in for the group membership to take effect. Verify with the id command.

$ id $USER | grep vboxusers
...groups=...,985(vboxusers)

Step 6: Install the VirtualBox Extension Pack

The Extension Pack adds USB 2.0/3.0 support, VirtualBox Remote Desktop Protocol (VRDP), disk encryption, NVMe, and PXE boot for Intel cards. It is free for personal, educational, and evaluation use under the PUEL license.

Download the Extension Pack matching your VirtualBox version. Check your installed version first.

VBOX_VERSION=$(vboxmanage --version | cut -dr -f1)
echo $VBOX_VERSION

Download the Extension Pack.

wget https://download.virtualbox.org/virtualbox/${VBOX_VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack

Install the Extension Pack using VBoxManage.

sudo vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-${VBOX_VERSION}.vbox-extpack

Accept the license when prompted. Verify the installation.

$ vboxmanage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      7.1.6
Revision:     167084
Description:  Oracle Cloud Infrastructure integration, USB 2.0 and USB 3.0 Host Controller, ...
VRDE Module:  VBoxVRDP
Crypto Module: VBoxPuelCrypto
Usable:       true
Why unusable:

Step 7: Create Your First VM Using the GUI

Launch VirtualBox from your desktop environment’s application menu or from the terminal.

virtualbox &

Follow these steps in the VirtualBox Manager window:

  1. Click New to open the Create Virtual Machine wizard
  2. Enter a name (e.g., “Rocky10-Test”), select Type as Linux, and Version as Red Hat (64-bit)
  3. Allocate at least 2048 MB of RAM
  4. Select Create a virtual hard disk now and choose VDI format
  5. Choose Dynamically allocated storage and set the size to at least 20 GB
  6. Click Create to finish

Before starting the VM, go to Settings > Storage, click the empty CD icon under Controller: IDE, and attach your guest OS ISO file. Then click Start to boot the VM and proceed with the OS installation.

Step 8: Create a VM Using VBoxManage CLI

For automation and scripted deployments, VBoxManage is more practical than the GUI. Here is how to create and configure a VM entirely from the command line. If you work with other virtualization platforms like KVM or QEMU, the CLI approach will feel familiar.

Create the VM and register it.

VBoxManage createvm --name "AlmaLinux10-CLI" --ostype RedHat_64 --register

Set CPU count and memory allocation.

VBoxManage modifyvm "AlmaLinux10-CLI" --cpus 2 --memory 2048 --vram 128

Create a virtual hard disk (30 GB, dynamically allocated).

VBoxManage createmedium disk --filename ~/VirtualBox\ VMs/AlmaLinux10-CLI/AlmaLinux10-CLI.vdi --size 30720 --format VDI

Add a SATA controller and attach the disk.

VBoxManage storagectl "AlmaLinux10-CLI" --name "SATA Controller" --add sata --controller IntelAhci
VBoxManage storageattach "AlmaLinux10-CLI" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/AlmaLinux10-CLI/AlmaLinux10-CLI.vdi

Add an IDE controller and attach the installation ISO.

VBoxManage storagectl "AlmaLinux10-CLI" --name "IDE Controller" --add ide
VBoxManage storageattach "AlmaLinux10-CLI" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium /path/to/AlmaLinux-10-x86_64-dvd.iso

Enable EFI boot and set the boot order.

VBoxManage modifyvm "AlmaLinux10-CLI" --firmware efi --boot1 dvd --boot2 disk --boot3 none --boot4 none

Configure networking (NAT by default).

VBoxManage modifyvm "AlmaLinux10-CLI" --nic1 nat

Start the VM.

VBoxManage startvm "AlmaLinux10-CLI" --type gui

List all registered VMs to confirm.

$ VBoxManage list vms
"AlmaLinux10-CLI" {a1b2c3d4-e5f6-7890-abcd-ef1234567890}

Step 9: Install VirtualBox Guest Additions

Guest Additions provide better video performance, shared folders, seamless mouse integration, shared clipboard, and time synchronization between host and guest. Install them inside your guest VM.

Boot into the guest OS, then from the VirtualBox menu bar select Devices > Insert Guest Additions CD image. Inside the guest, mount the CD and run the installer.

sudo mount /dev/cdrom /mnt
sudo dnf install gcc make perl kernel-devel kernel-headers -y
sudo /mnt/VBoxLinuxAdditions.run

After installation completes, reboot the guest VM.

sudo reboot

Verify Guest Additions are loaded in the guest.

$ lsmod | grep vboxguest
vboxguest             434176  2 vboxsf

Step 10: Configure Shared Folders

Shared folders let you exchange files between the host and guest without network transfers. Guest Additions must be installed first (Step 9).

Create a shared folder from the host using VBoxManage.

VBoxManage sharedfolder add "AlmaLinux10-CLI" --name "shared_data" --hostpath /home/user/shared --automount

Inside the guest VM, the shared folder auto-mounts at /media/sf_shared_data. If it does not auto-mount, mount it manually.

sudo mkdir -p /mnt/shared
sudo mount -t vboxsf shared_data /mnt/shared

To make the mount persistent across reboots, add this line to /etc/fstab in the guest.

shared_data    /mnt/shared    vboxsf    defaults,uid=1000,gid=1000    0 0

Your guest user needs to be in the vboxsf group to access auto-mounted shared folders.

sudo usermod -aG vboxsf $USER

Step 11: Configure Networking – Bridged and NAT

VirtualBox supports several networking modes. The two most commonly used are NAT and Bridged networking.

NAT Networking (Default)

NAT is the default mode. The guest accesses the internet through the host’s network stack but is not directly reachable from other machines on the network. This is ideal for general internet access within the VM.

VBoxManage modifyvm "AlmaLinux10-CLI" --nic1 nat

To forward a port from host to guest (for example, SSH on port 2222):

VBoxManage modifyvm "AlmaLinux10-CLI" --natpf1 "ssh,tcp,,2222,,22"

You can then SSH into the guest from the host using port 2222.

ssh [email protected] -p 2222

Bridged Networking

Bridged mode places the VM directly on the physical network, giving it its own IP address from the DHCP server. Other machines on the LAN can reach the VM directly. This is useful for running servers inside VMs.

VBoxManage modifyvm "AlmaLinux10-CLI" --nic1 bridged --bridgeadapter1 enp0s3

Replace enp0s3 with your actual host network interface name. Find it with ip link show.

NAT Network (Multiple VMs)

If you need multiple VMs to communicate with each other while sharing a single NAT gateway, create a NAT Network.

VBoxManage natnetwork add --netname "lab-net" --network "10.0.2.0/24" --enable --dhcp on
VBoxManage modifyvm "AlmaLinux10-CLI" --nic1 natnetwork --nat-network1 "lab-net"

Step 12: USB Passthrough

USB passthrough lets the guest VM access USB devices connected to the host. The Extension Pack (Step 6) is required for USB 2.0 and 3.0 support. Your user must also be in the vboxusers group (Step 5).

Enable USB 3.0 (xHCI) controller for a VM.

VBoxManage modifyvm "AlmaLinux10-CLI" --usbxhci on

List USB devices available on the host.

$ VBoxManage list usbhost
UUID:               a1b2c3d4-1234-5678-abcd-ef0123456789
Current State:      Available
VendorId:           0x0781 (0781)
ProductId:          0x5567 (5567)
Manufacturer:       SanDisk
Product:            Cruzer Blade

Create a USB filter to automatically attach a specific device when the VM starts.

VBoxManage usbfilter add 0 --target "AlmaLinux10-CLI" --name "SanDisk USB" --vendorid 0x0781 --productid 0x5567

You can also attach USB devices on the fly while the VM is running through the Devices > USB menu in the VirtualBox GUI.

Step 13: Run VMs in Headless Mode (VBoxHeadless)

Headless mode runs VMs without a GUI window, which is perfect for server environments or when managing VMs over SSH. This is especially useful if you are managing remote servers through tools like VMware Workstation or VirtualBox on headless hosts.

Start a VM in headless mode.

VBoxManage startvm "AlmaLinux10-CLI" --type headless

Alternatively, use the dedicated headless command.

VBoxHeadless --startvm "AlmaLinux10-CLI"

Check the status of running VMs.

$ VBoxManage list runningvms
"AlmaLinux10-CLI" {a1b2c3d4-e5f6-7890-abcd-ef1234567890}

To access a headless VM’s console, enable VRDP (requires the Extension Pack) and connect with any RDP client.

VBoxManage modifyvm "AlmaLinux10-CLI" --vrde on --vrdeport 5001

Connect from a remote machine using an RDP client pointed at your-host-ip:5001.

Control the VM lifecycle from the command line.

# Graceful shutdown (ACPI power button)
VBoxManage controlvm "AlmaLinux10-CLI" acpipowerbutton

# Force power off
VBoxManage controlvm "AlmaLinux10-CLI" poweroff

# Pause and resume
VBoxManage controlvm "AlmaLinux10-CLI" pause
VBoxManage controlvm "AlmaLinux10-CLI" resume

# Save state (hibernate)
VBoxManage controlvm "AlmaLinux10-CLI" savestate

Step 14: Set Up phpVirtualBox Web Interface

phpVirtualBox is a web-based front end for VirtualBox that mimics the desktop GUI. It is useful for managing VMs on headless servers from a browser. You need a working Apache/Nginx + PHP installation on the host.

Install the required packages.

sudo dnf install httpd php php-xml php-soap php-json -y
sudo systemctl enable --now httpd

Enable the VirtualBox web service. First, create a file that defines the user running vboxweb-service.

echo "VBOXWEB_USER=your_username" | sudo tee /etc/default/virtualbox

Replace your_username with the user account that owns the VMs. Start the vboxweb-service.

sudo systemctl enable --now vboxweb-service

Download and install phpVirtualBox. Check the phpVirtualBox GitHub repository for the latest release compatible with VirtualBox 7.1.

cd /var/www/html
sudo git clone https://github.com/phpvirtualbox/phpvirtualbox.git
cd phpvirtualbox
sudo cp config.php-example config.php

Edit the configuration file to set the VirtualBox user credentials.

sudo vi /var/www/html/phpvirtualbox/config.php

Update these values.

var $username = 'your_username';
var $password = 'your_password';
var $location = 'http://127.0.0.1:18083/';

Set correct permissions and configure SELinux if it is enforcing.

sudo chown -R apache:apache /var/www/html/phpvirtualbox
sudo setsebool -P httpd_can_network_connect 1

Open the firewall for HTTP access.

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Access phpVirtualBox at http://your-server-ip/phpvirtualbox. The default login credentials are admin/admin. Change the password immediately after first login.

Troubleshooting VirtualBox on Rocky Linux 10 / AlmaLinux 10

vboxdrv Kernel Module Not Loading

The most common issue after installation is the vboxdrv module failing to build or load. This usually means kernel-devel does not match your running kernel.

sudo dnf install kernel-devel-$(uname -r) -y
sudo /sbin/vboxconfig

If the exact kernel-devel package is not available, update the kernel and reboot first.

sudo dnf update kernel kernel-devel -y
sudo reboot

After reboot, rebuild the modules.

sudo /sbin/vboxconfig

Secure Boot Blocking vboxdrv

If Secure Boot is enabled in UEFI, unsigned kernel modules like vboxdrv are blocked from loading. You have two options.

Option 1: Disable Secure Boot in your UEFI/BIOS settings. This is the simplest approach for workstations.

Option 2: Sign the VirtualBox kernel modules with a Machine Owner Key (MOK). This keeps Secure Boot active.

# Generate a signing key pair
sudo mkdir -p /root/module-signing
cd /root/module-signing
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox Module Signing/"

# Enroll the key (requires reboot and manual confirmation)
sudo mokutil --import MOK.der

# After reboot and MOK enrollment, sign the modules
for module in vboxdrv vboxnetflt vboxnetadp; do
  sudo /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 /root/module-signing/MOK.priv /root/module-signing/MOK.der /lib/modules/$(uname -r)/misc/${module}.ko
done

# Load the signed module
sudo modprobe vboxdrv

Rebuilding Modules After Kernel Updates

Every time the kernel is updated and you reboot into a new kernel, VirtualBox modules must be rebuilt. If you installed VirtualBox from the Oracle repo, DKMS should handle this automatically. Verify DKMS is tracking VirtualBox.

$ dkms status
vboxhost/7.1.6_OSE, 5.14.0-503.40.1.el10_0.x86_64, x86_64: installed

If modules are not rebuilt automatically, trigger a manual rebuild.

sudo /sbin/vboxconfig

VM Fails to Start with NS_ERROR_FAILURE

This error typically means the VirtualBox services are not running. Restart them.

sudo systemctl restart vboxdrv

If the service does not exist, run the setup script.

sudo /sbin/vboxconfig

USB Device Not Visible in Guest

Confirm your user is in the vboxusers group and the Extension Pack is installed. Also check that the correct USB controller (OHCI for 1.1, EHCI for 2.0, xHCI for 3.0) is enabled for the VM.

VBoxManage showvminfo "AlmaLinux10-CLI" | grep -i usb

Conclusion

VirtualBox 7.1 is fully functional on Rocky Linux 10 and AlmaLinux 10 for both desktop and headless server use. We covered the full workflow from installation and kernel module building through VM creation (GUI and CLI), guest additions, shared folders, networking modes, USB passthrough, headless operation, and the phpVirtualBox web interface.

For production use, consider enabling VRDP with TLS encryption, setting up automated VM backups using VBoxManage clonevm or snapshot exports, and monitoring host resource usage to avoid overcommitting CPU and RAM across your VMs. If you need a bare-metal hypervisor for heavier workloads, look into converting VDI images to qcow2 for migration to KVM.

Related Guides

LEAVE A REPLY

Please enter your comment!
Please enter your name here