Install VirtualBox 6.1 on AlmaLinux 9 – A No‑Nonsense Guide
If you’re stuck in a loop of “I can’t get VirtualBox to launch” after pulling the 6.1 installer onto AlmaLinux 9, this is for you. We’ll walk through the exact steps that actually work, why each one matters, and what to skip because it only makes your life harder.
1. Make sure the kernel and headers match
VirtualBox 6.1 will refuse to load its modules unless the running kernel and the installed kernel‑devel package are in sync. On AlmaLinux 9 you can verify this with:
uname -r # shows your current kernel version rpm -q kernel-devel | grep "$(uname -r)"
If they differ, install the correct header set:
sudo dnf install kernel-devel-$(uname -r)
Why bother? VirtualBox builds a module at install time that is tightly coupled to your kernel. A mismatch will surface as “module not found” or “invalid module format”.
2. Install required build tools and dependencies
VirtualBox’s RPM pulls in many packages, but you’ll still need the development tools for the kernel modules:
sudo dnf groupinstall "Development Tools" sudo dnf install gcc make perl dkms
I’ve seen users skip this step only to hit a compile error halfway through. Don’t.
3. Add the Oracle VirtualBox repo
The official 6.1 package is available from Oracle’s public repository. Grab the repo file and import its GPG key:
sudo dnf install -y https://download.virtualbox.org/virtualbox/rpm/el/VirtualBox.repo curl -L https://www.virtualbox.org/download/oracle_vbox.asc | gpg --dearmor | sudo tee /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle-vbox > /dev/null sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle-vbox
Why the repo? Without it you’d have to manually download and install an RPM, which is more error‑prone on a rolling distribution like AlmaLinux. The repo keeps your VirtualBox version up to date with security patches.
4. Install VirtualBox 6.1
Now the heavy lifting:
sudo dnf install VirtualBox-6.1
During installation you’ll see a prompt about loading kernel modules. Press “yes” or hit `Enter`. If it fails, double‑check that your kernel headers are present (see step 1).
5. Enable the VirtualBox kernel module and add yourself to the vboxusers group
After the RPM finishes, load the module:
sudo modprobe vboxdrv
Add your user so you can run VMs without root:
sudo usermod -aG vboxusers $(whoami)
You’ll need to log out and back in for the group change to take effect.
6. Verify everything works
Open a terminal and type:
VBoxManage list systemproperties
If you get a listing, the engine is up and running. If it complains about “module not found”, re‑run `modprobe` or revisit step 1.
Common gotchas
- SELinux blocking the driver – On some hard‑core setups, SELinux may refuse to load the module. Temporarily set it to permissive while you troubleshoot: `sudo setenforce 0`. Don’t forget to re‑enable it afterward.
- Running a custom kernel – If you’re using a non‑stock kernel (e.g., a patched mainline), VirtualBox 6.1 will probably choke because the headers won’t match. Stick with the distribution’s kernel or upgrade to VirtualBox 7.x which supports newer kernels better.
That’s it. You now have VirtualBox 6.1 up and running on AlmaLinux 9, ready for those old‑school VMs that still only support that version. If you hit any snags beyond this, drop a comment – we’ve all been there.