How To Install VirtualBox 6.1 on Fedora 35/34

Channel: Linux
Abstract: So we need to configure environment variable KERN_DIR to which VirtualBox get kernel source code. In my case latest kernel source is available in 4.16

Oracle Corporation Team has released its new major version VirtualBox 6.1.32 on Jan 18, 2022. In this release VirtualBox has improves stability and fixes regressions. To read more about this release read changelog.

This tutorial will help you to install Oracle VirtualBox 6.1 on Fedora 35/34/33/32/31/30 Linux systems using DNF.

Step 1 – Prerequisites

First of all, You need to configure the yum repository to install Virtualbox on your Fedora system. You can simply download the repo file from its official site and place it under at /etc/yum.repos.d/virtualbox.repo. Navigate to /etc/yum.repos.d directory and use one of the below commands as per your operating system.

cd /etc/yum.repos.d/
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

Before installing VirtualBox make sure to install all required packages to run VirtualBox like kernel-headers, kernel-devels, etc. Use the following command to install the required packages.

sudo dnf install binutils gcc make patch libgomp dkms qt5-qtx11extras libxkbcommon
sudo dnf install glibc-headers glibc-devel kernel-headers kernel-devel compat-libvpx5

After installing the latest kernel and kernel headers, let’s reboot your system and start with the Latest kernel.

sudo reboot
Step 2 – Configure Environment

VirtualBox installation required kernel source code to install required modules, So we need to configure environment variable KERN_DIR to which VirtualBox get kernel source code. In my case latest kernel source is available in 4.16.5-300.fc28.x86_64 directory under /usr/src/kernels/ . Make sure you are using correct source path.

export KERN_DIR=/usr/src/kernels/`uname -r`
echo $KERN_DIR

/usr/src/kernels/4.16.5-300.fc28.x86_64
Step 3 – Install VirtualBox on Fedora

Use the following command to install VirtualBox using the DNF command-line tool. It will install the latest version of VirtualBox on your Fedora system.

sudo dnf install VirtualBox-6.1

After installation, we need to rebuild kernel modules using the following command.

sudo /usr/lib/virtualbox/vboxdrv.sh setup
Step 4 – Launch VirtualBox

You can use the application launcher or use the following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.

virtualbox

Conclusion

In this tutorial, you have learned to install VirtualBox on the Fedora system. Now, you can create virtual machines for operating systems of your choice and work on them.

Ref From: tecadmin

Related articles