Virtualbox is an open source type 2 hypervisor software used to create and run virtual machines on various operating systems i.e Linux, Windows, OS/2, Solaris, MacOS e.t.c .VirtualBox was first released in 2007.It was released as a free software licensed under GPL v2 with extension pack that contains driver released under PUEL which restricts commercial use.

Virtualbox 6.1 was released in December 2019. It has many amazing features, among them are:

  1. Ability to import and export a VM from OCI
  2. Has an updated extensible Firmware Interfaces and use
  3. Supports nested virtualization on Intel CPUs
  4. Has imported VM groups and storage settings
  5. Offers the ability to create multiple VM instances

Getting Started

In this article we will be performing an install of VirtualBox 6.1 on Rocky Linux 8. To run Virtualbox on your system make sure Virtualization is enabled on your processor. Check if Virtualization is enabled in BIOS/EFI.

egrep -c '(vmx|svm)' /proc/cpuinfo

Sample output: (must be non zero) if 0, virtualization is not enabled

$ egrep -c '(vmx|svm)' /proc/cpuinfo
4

Also ensure your host Operating System is 64-bit by executing:

$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              1
On-line CPU(s) list: 0
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               69

Install Virtualbox 6.1 on Rocky Linux 8

Downloading and installing Virtualbox on Rocky Linux 8 is easy. We will use the following steps:

Step 1. Add VirtualBox Repositories.

Install EPEL repository on your Rocky System:

sudo dnf install epel-release

Confirm the installed version

 rpm -q epel-release

Then proceed and install kernel headers.

sudo dnf install gcc make perl kernel-devel kernel-headers bzip2 dkms

Update the kernel

sudo dnf update kernel-*

Add Virtualbox repositories to our Rocky Linux 8 system to be able to install Virtualbox.

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

After the repository is added, run a system update for the changes to take effect.

sudo dnf update

Step 2. Install Virtualbox 6.1 on Rocky Linux 8

In the added repository, there are a multiple versions of Virtualbox. First we search for the versions available.

dnf search virtualbox

Sample output

Last metadata expiration check: 0:00:10 ago on Sat 17 Jul 2021 12:28:27 AM EAT.
====================== Name & Summary Matched: virtualbox ======================
VirtualBox-5.2.x86_64 : Oracle VM VirtualBox
VirtualBox-6.0.x86_64 : Oracle VM VirtualBox
VirtualBox-6.1.x86_64 : Oracle VM VirtualBox

When I was writing this article, there were 3 versions of Virtualbox available. Install Virtualbox 6.1 using this command:

sudo dnf install VirtualBox-6.1

Dependency tree:

Dependencies resolved.
================================================================================
 Package                Arch      Version                   Repository     Size
================================================================================
Installing:
 VirtualBox-6.1         x86_64    6.1.22_144080_el8-1       virtualbox     90 M
Installing dependencies:
 SDL                    x86_64    1.2.15-39.el8             appstream     217 k
 qt5-qtbase             x86_64    5.12.5-8.el8.2            appstream     3.4 M
 qt5-qtbase-common      noarch    5.12.5-8.el8.2            appstream      39 k
 qt5-qtbase-gui         x86_64    5.12.5-8.el8.2            appstream     5.8 M
 qt5-qtx11extras        x86_64    5.12.5-1.el8              appstream      39 k
 xcb-util-image         x86_64    0.4.0-9.el8               appstream      20 k
 xcb-util-keysyms       x86_64    0.4.0-7.el8               appstream      15 k
 xcb-util-renderutil    x86_64    0.3.9-10.el8              appstream      18 k
 xcb-util-wm            x86_64    0.4.1-12.el8              appstream      31 k

Transaction Summary
================================================================================
Install  10 Packages

Total download size: 99 M
Installed size: 227 M
Is this ok [y/N]: y

Accept the key importation as below:

Importing GPG key 0x98AB5139:
 Userid     : "Oracle Corporation (VirtualBox archive signing key) <[email protected]>"
 Fingerprint: 7B0F AB3A 13B9 0743 5925 D9C9 5442 2A4B 98AB 5139
 From       : https://www.virtualbox.org/download/oracle_vbox.asc
Is this ok [y/N]: y

Installing Virtualbox Extension Pack on Rocky Linux 8

Now we need to download extensions to support a variety of features such as Using USB 2.0, USB 3.0 devices , virtualbox RDP, disk encryption, NVMe and PXE boot for intel cards. This extension pack is downloaded from the official website

On the site, navigate to VirtualBox Extension pack all supported platforms as shown below.

After downloading it, navigate to the download directory and find the file you downloaded example:

$ cd Downloads

view available files, you should see this file

$ ls
Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack

Then install it

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack

Agree to the Licence terms and proceed with the installation.

Then build kernel modules

$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.

Use VirtualBox 6.1

With virtualbox installed, we now want to put it in use. We will try and install Ubuntu server 20.04 LTS from an ISO file.

Launch Virtualbox from the Activities/App Menu as below:

Creating a Virtual Machine on VirtualBox

When virtualbox launches, click New to create a new Virtual Machine. While here, you can create a virtual machine (Ubuntu 20.04LTS) with the following steps.

step 1. Set the machine Name and Type

Set the name,the path to store files and the type of operating system

Step 2. Set Memory and Storage

Then we set the memory for your virtual machine.

Create a hard disk for your virtual machine set the storage type and size.

Step 4. Add an Installation Media

After you have made the above settings, we now want to add an Installation media. In this case, we will use an ISO file. To add an installation media, navigate to the Settings -> Storage and add the ISO at contoller IDE click add optical drive as below

While on the above page, locate the ISO file for the virtual machine you want to create. Click on +Add to go to the files. After you have successfully added the ISO, click OK to apply the changes

Step 4. Start the Installation.

Now click “start” to start your machine. When the machine starts, our installation starts as below

Go through the normal installation process of Ubuntu or whichever Operating system you are installing.

When installation is complete, shutdown your machine, navigate to the settings tab and unmount the ISO file by right clicking at it and select “Remove attachment”

You can now run your installed virtual machine by clicking on “Start”

Virtualbox has many other features, one can run a virtual machine by importing a file such as an OVA/OVF file for the machine. You can also make network, display, audio and many other settings for the machine. It also allows one save snapshots and export Virtual Machine OVA and OVF files. With these files (templete), one can easily deploy a similar virtual machine from them

Conclusion

In this article, we have walked through a step by step demonstration on how to install VirtualBox 6.1 on Rocky Linux 8. I have also demonstrated how to set up a simple virtual machine with Virtualbox. I hope this article was helpful.

Find more articles on our website.

How To Install VirtualBox 6.x on Linux Mint

Importing Virtual Machine from VirtualBox to KVM

Install VirtualBox Guest Additions on Manjaro Linux

LEAVE A REPLY

Please enter your comment!
Please enter your name here