How to Install VirtualBox on AlmaLinux / Rocky Linux

How to Install VirtualBox on AlmaLinux / Rocky Linux: A Full Guide

This guide will walk you through the steps to install VirtualBox, a general-purpose full virtualizer app, on AlmaLinux or Rocky Linux.

VirtualBox is a free and open-source virtualization software commonly used at the desktop level to create a test environment. It enables you to create and run virtual machines, which are guest operating systems including Linux, Windows, Unix, and Solaris.

Unfortunately, VirtualBox is not available for installation in the official AlmaLinux and Rocky Linux repositories. However, there is an effortless and straightforward way to install it, which we will show you in easy-to-follow steps in this guide.

Install VirtualBox on AlmaLinux / Rocky Linux

The tutorial will be using the sudo command and assuming you have sudo privileges.

Step 1: Add VirtualBox Repository

VirtualBox, as previously stated, is not available for installation in the AlmaLinux and Rocky Linux repositories. So, we’ll add its official repository to our AlmaLinux/Rocky Linux system with the command below.

To do so, type the following commands:

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

Next, we’ll update the package list. Next, you will be asked if you accept importing the VirtualBox’s repository public key into your system. Confirm by typing y and pressing Enter.

Updating packages list

Step 2: Check Versions Available for Installation

This step will search for VirtualBox versions available for installation on our AlmaLinux / Rocky Linux system.

sudo dnf search virtualbox
Check available VirtualBox versions for Installation

As can be seen, we have three options: versions 5.2, 6.0, and 6.1. So we’ll install the latest VirtualBox 6.1 version, which provides us with the most recent and best features of this virtualization software.

Step 3: Install Prerequisites

In this step, we will install several packages that VirtualBox needs during its installation to build the essential components for its proper operation.

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

Step 4: Install VirtualBox on AlmaLinux / Rocky Linux

Everything is already prepared for the actual installation. Now, to install VirtualBox on our AlmaLinux / Rocky Linux system, run the following commands:

sudo dnf install VirtualBox-6.1

When prompted, type y to confirm that you want to install it and press Enter.

Install VirtualBox on AlmaLinux / Rocky Linux

That’s all. The VirtualBox is installed successfully and ready to be used on your AlmaLinux / Rocky Linux system.

In addition, you can run the below command to check the status of VirtualBox’s Linux kernel module service.

sudo systemctl status vboxdrv
Checking VirtualBox's Linux kernel module service status

Great! As you can see, the service is fully operational.

Step 5: Install VirtualBox Extension Pack

This is an optional step, but I strongly encourage it because it will make working with VirtualBox on your AlmaLinux / Rocky Linux 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

One peculiarity should be highlighted here. The VirtualBox Extension Pack’s version needs to match the version of VirtualBox installed on your system. The simplest method to check this is to run:

sudo rpm -aq | grep VirtualBox
Checkinf installed VirtualBox version

As you can see, the version of Virtualbox installed is 6.1.34. Therefore, the Extension Pack with the same version needs then be downloaded.

So, use the below wget command to download the Extension Pack for VirtualBox.

If your installation is different, replace both places containing 6.1.34 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/6.1.34/Oracle_VM_VirtualBox_Extension_Pack-6.1.34.vbox-extpack

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

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.34.vbox-extpack

When prompted to agree the Oracle’s license terms and conditions, type y to confirm and press Enter.

Installing VirtualBox Extension Pack

You can verify that the extension pack was installed correctly by running:

vboxmanage list extpacks
Verifying VirtualBox Extension Pack version

Step 6: Run VirtualBox App on AlmaLinux / Rocky Linux

Finally, you can start using VirtualBox by launching it from the desktop environment’s application menu.

Run VirtualBox on AlmaLinux / Rocky Linux
Run VirtualBox on AlmaLinux / Rocky Linux

Conclusion

That concludes our guide on installing VirtualBox on AlmaLinux / Rocky Linux. We hope you find this guide useful. Thanks for your time!

Related: How to Install VirtualBox on Debian 11 (Bullseye): A Step-by-Step Guide

We recommend checking the official documentation for individuals who want to learn more about the features offered by VirtualBox and how to use them effectively.

Your feedback and comments are most welcome.

Leave a Reply

Your email address will not be published.