VirtualBox 7 on Fedora 40/39/38: A Full Installation Guide

Learn how to install VirtualBox on Fedora 40/39/38 with our comprehensive guide. Follow the steps for a smooth installation experience!

VirtualBox 7 is a popular virtualization solution that allows you to run multiple operating systems on a single physical host. This guide will show you how to install it on your Fedora 40, 39, or 38 system, a Red Hat-supported Linux distro known for its cutting-edge software, user-friendliness, and great support.

Simply follow the steps outlined below, which we tested and proven to work, and you’ll be up and running in no time with a system ready to meet all your virtualization needs.

Disclaimer: While this guide focuses on installing VirtualBox on Fedora 40, it’s equally applicable to earlier versions, such as 39, 38, etc.

Step 1: Install VirtualBox Dependencies

First, you need to install some dependencies. These are specific software packages that are required for VirtualBox to run properly.

Using the DNF package manager, we will install the “development-tools” meta package and several kernel-related packages required for VirtualBox to function.

Open the terminal and run the following two commands:

sudo dnf install @development-tools
sudo dnf install kernel-headers kernel-devel dkmsCode language: Bash (bash)

Step 2: Add VirtualBox Repository to Fedora

Next, we will add the official VirtualBox repository to our Fedora 40 system. This implies that the update package will be made available with the rest of your system’s regular updates if a new version is released.

Using your preferred terminal text editor, create the “/etc/yum.repos.d/virtualbox.repo” file:

sudo nano /etc/yum.repos.d/virtualbox.repoCode language: Bash (bash)

Then, put the content provided below in it, save it, and exit the file.

[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox_2016.ascCode language: Bash (bash)
Add VirtualBox repository to Fedora 40.
Add VirtualBox repository to Fedora 40.

Next, refresh the package list. When prompted, agree to import the GPG key signing packages from Oracle’s official VirtualBox repository by typing “y.”

sudo dnf updateCode language: Bash (bash)
Refresh the package base.
Refresh the package base.

Step 3: Install VirtualBox on Fedora 40

Finally, we are all set for the actual installation. Now, to install VirtualBox on your Fedora 40 system, run the following commands:

sudo dnf install VirtualBox-7.0Code language: CSS (css)
Install VirtualBox on Fedora 40.
Install VirtualBox on Fedora 40.

During the installation process, you will be prompted to import the GPG key again. Type “y” and press “Enter.” Wait for the installation to complete.

Now that VirtualBox is installed and ready to roll on your Fedora 40 system, there’s one more step before we seize its opportunities.

Step 4: Install VirtualBox Extension Pack

This is an optional step, but I strongly encourage it because it will make working with VirtualBox on your Fedora system easier and more convenient. VirtualBox Extension Pack unlocks many great features, such as:

  • USB 2 and USB 3 support
  • VirtualBox Remote Desktop Protocol (VRDP)
  • Host webcam passthrough
  • Disk image encryption with AES algorithm
  • Intel PXE boot ROM

Here’s an interesting point: Although not obligatory, it’s strongly advised that you ensure the version of the VirtualBox Extension Pack you install matches the version of VirtualBox on your Fedora 40 system.

To verify the exact version of the installed locally VirtualBox, you can use vboxmanage, a build-in VirtualBox’s command:

vboxmanage -v | cut -dr -f1
Check the installed VirtualBox version.
Check the installed VirtualBox version.

As you can see, the installed version of Virtualbox is “7.0.18.” So, we’ll use the below wget command to download the VirtualBox’s Extension Pack with the same version.

If your installation is different, replace both places containing “7.0.18” in the command below with the current version. In addition, you can also go straight to the downloads page and look at the available versions.

wget https://download.virtualbox.org/virtualbox/7.0.18/Oracle_VM_VirtualBox_Extension_Pack-7.0.18.vbox-extpackCode language: Bash (bash)

Next, to install the VirtualBox Extension pack, run the vboxmanage command as follows:

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.18.vbox-extpackCode language: Bash (bash)

You will be prompted to agree to Oracle’s license terms and conditions. To confirm, type “y” and press “Enter.”

Install VirtualBox Extension Pack.
Install VirtualBox Extension Pack.
Install VirtualBox Extension Pack.
Install VirtualBox Extension Pack.

Additionally, you can verify installed VirtualBox’s extension pack version by running the following:

vboxmanage list extpacksCode language: PHP (php)
Verify the installed VirtualBox Extension Pack version.
Verify the installed VirtualBox Extension Pack version.

Step 5: Add User to vboxusers Group

Before using VirtualBox, add your user account to the “vboxusers” group. This is quick and simple to accomplish by running:

sudo usermod -a -G vboxusers $USERCode language: Bash (bash)

Now, perform a reboot. After login, check that you are in the “vboxusers” group with this command:

groups $USERCode language: Bash (bash)
Check the user's groups.
Check the user’s groups.

Step 6: Running VirtualBox on Fedora 40

Launching it from the desktop environment’s application menu, you can now start using VirtualBox. Type “virtualbox” and click on the icon when it appears.

Running VirtualBox on Fedora 40.
Running VirtualBox on Fedora 40.
VirtualBox 7 is running on Fedora 40.
VirtualBox 7 is running on Fedora 40.

To start creating a new virtual machine, use the “New” button.

How to Uninstall VirtualBox

If you uninstall VirtualBox from your Fedora system for any reason, you can do it easily by running the command below.

sudo dnf remove VirtualBox-7.0Code language: Bash (bash)
Uninstall VirtualBox.
Uninstall VirtualBox.

Then you have two choices: disable the VirtualBox repository on your Fedora system:

sudo dnf config-manager --set-disabled virtualboxCode language: Bash (bash)

Or completely remove it by deleting the repo’s file:

sudo rm /etc/yum.repos.d/virtualbox.repoCode language: Bash (bash)

Conclusion

Installing VirtualBox 7 on Fedora 40 can give users a powerful and versatile virtualization solution for running multiple operating systems on a single machine.

With Fedora 40 as the host operating system, you can now take advantage of its stability, security, and cutting-edge software, making it a reliable platform for virtualization.

The installation process outlined in this guide provides a comprehensive and detailed approach to setting up VirtualBox 7 on Fedora 40, ensuring that users can follow along and successfully install the software.

Thanks for using this tutorial! Any feedback is welcomed in the section below.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%