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, etc.
Immediately, I want to clarify that VirtualBox is unavailable for installation in the officialย Alma and Rockyย repos. However, there is an effortless and straightforward way to install it, which I will show you in easy-to-follow steps in this guide.
Install VirtualBox on AlmaLinux / Rocky Linux
The tutorial will use the sudo command and assume you, as a regular user, already have sudo privileges.
Step 1: Add VirtualBox Repository
As previously stated, VirtualBox is unavailable for installation in the AlmaLinux and Rocky Linux repos. So, the first thing to do is add its official repository to our system with the command below.
To do so, type the following:
sudo dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
Code language: Bash (bash)
Next, update the package list. You will be asked if you accept importing the VirtualBox’s repository public key into your system. Confirm by typing “y
” and pressing Enter
.
sudo dnf update
Code language: Bash (bash)
Step 2: Check Versions Available for Installation
This step will search for VirtualBox versions that are available for installation on our AlmaLinux / Rocky Linux system.
sudo dnf search virtualbox
Code language: Bash (bash)
As can be seen, we have three options available: 6.1, 7.0, and 7.1. Of course, we opt for the latest and greatest VirtualBox 7.1, which provides us with this virtualization software’s most recent and best features.
Step 3: Install Prerequisites
But first, we must 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
Code language: Bash (bash)
Step 4: Install VirtualBox 7.1 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-7.1
Code language: Bash (bash)
When prompted, typeย “y”ย to confirm and hitย “Enter.”
Just to clarify, during the installation, you’ll again be prompted to import the repo’s GPG signing key. Just type “y” and press “Enter” to import it. And that’s all! VirtualBox has been installed successfully and is ready for use on your Alma / Rocky system.
In addition, you can run the below command to check the status of VirtualBox’s Linux kernel module service.
sudo systemctl status vboxdrv
Code language: Bash (bash)
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:
- Oracle Cloud Infrastructure (OCI) integration
- VirtualBox Remote Desktop Protocol (VRDP)
- Host webcam passthrough
- Disk and full VM encryption
We should highlight one peculiarity here. It is highly recommended that the version of the installed VirtualBox Extension Pack match the version of VirtualBox installed on your AlmaLinux / Rocky Linux system.
So, to verify the exact version of the installed locally VirtualBox, you can use vboxmanage
, a build-in VirtualBox command:
vboxmanage -v | cut -dr -f1
Code language: Bash (bash)
As you can see, the version of the installed Virtualbox is 7.1.0. Therefore, the Extension Pack with the same version needs to be downloaded. So, use the below wget
command to download the needed Extension Pack’s version.
However, if your installation is different, replace both places containing 7.1.0 in the command with the actual version. Additionally, you can go straight to theย downloads page and look at the available versions.
wget https://download.virtualbox.org/virtualbox/7.1.0/Oracle_VirtualBox_Extension_Pack-7.1.0.vbox-extpack
Code language: Bash (bash)
Next, to install the VirtualBox Extension pack, run the vboxmanage
command as follows:
sudo vboxmanage extpack install Oracle_VirtualBox_Extension_Pack-7.1.0.vbox-extpack
Code language: Bash (bash)
When prompted to agree to Oracleโs license terms and conditions, typeย “y”ย to confirm and pressย “Enter.”
Finally, you can verify that the extension pack was installed correctly by running:
vboxmanage list extpacks
Code language: Bash (bash)
Step 6: Add User to vboxusers Group
Before using VirtualBox, you should add your user account to the vboxusers
group. This is quick and simple to accomplish by running:
sudo usermod -a -G vboxusers $USER
Code language: Bash (bash)
Now, perform a reboot. After login, check that your regular user is a member of the “vboxusers” group:
groups $USER
Code language: PHP (php)
Step 7: Running VirtualBox on AlmaLinux / Rocky Linux
Finally, you can start using VirtualBox by launching it from the GNOME Dash menu.
Conclusion
That concludes our guide on installing VirtualBox on AlmaLinux / Rocky Linux. We hope you find this guide useful. Thanks for your time!
We recommend checking theย official documentationย for individuals who want to learn more about VirtualBox’s features and how to use them effectively.
Finally, you can use VirtualBox in an entirely headless mode to turn your server into a virtualization environment. To learn more about utilizing this VirtualBox feature, check out our guide: โHow to Setup and Manage VMs on a Headless VirtualBox Server.โ
Thanks for using this tutorial. Your feedback and comments are most welcome.