How to Install VirtualBox on Fedora

Method 1: Install from Fedora Repository (Recommended)

  1. Enable the VirtualBox Repository:

    sudo dnf install -y fedora-workstation-repositories
    sudo dnf config-manager --set-enabled virtualbox
  2. Import VirtualBox's GPG Key:

    sudo rpm --import https://www.virtualbox.org/download/oracle_vbox.asc
  3. Install VirtualBox:

    sudo dnf install -y VirtualBox
  4. Install Kernel Modules:

    sudo dnf install -y akmod-VirtualBox kernel-devel
    sudo akmods --force
    sudo systemctl restart vboxdrv
  5. Add Your User to vboxusers Group:

    sudo usermod -aG vboxusers $USER
    Note: You'll need to log out and back in for this change to take effect.
  6. Launch VirtualBox:

    VirtualBox

Method 2: Manual Installation from Oracle

  1. Download the RPM Package:

    Visit VirtualBox's download page and get the Fedora package.

  2. Install Dependencies:

    sudo dnf install -y @development-tools kernel-devel kernel-headers dkms qt5-qtx11extras libxkbcommon
  3. Install the Downloaded RPM:

    sudo dnf install -y ./VirtualBox-*.rpm
  4. Rebuild Kernel Modules:

    sudo /sbin/vboxconfig

Troubleshooting

Kernel Module Errors:

If you encounter kernel module issues, ensure your kernel headers match:

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

Secure Boot Issues:

If VirtualBox fails due to Secure Boot:

Now you can launch VirtualBox from your applications menu or via terminal. Enjoy your virtual machines! 🚀