How To Install VirtualBox on Rocky Linux 8 / CentOS 8 / RHEL 8

0

VirtualBox is an open-source hypervisor software that helps us to create and run virtual machines of Linux, Windows, OS/2, Solaris, and other supported operating systems on top of the host operating system. 

VirtualBox can run on Linux, Windows, macOS, and Solaris. It is an alternative to proprietary hypervisor VMware workstation and Kernel Virtual Machine.

VirtualBox is released as free software under GPL v2, and its extension pack that contains drivers is released under PUEL, which restricts commercial usage.

Here, we will see how to install VirtualBox on Rocky Linux 8 / CentOS 8 / RHEL 8.

THIS DOCUMENT IS ALSO AVAILABLE FOR

Prerequisites

To run 64bit virtual machine’s operating systems, make sure your system processor supports hardware virtualization (VT) and is enabled in BIOS. Also, the host operating system must be 64bit as well.

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

Output: (Must be nonzero)

2

Update System (Optional)

Update the system to the latest version.

dnf update -y

Install Development Tools

Install the kernel-header and other development tools.

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

Also, install the wget package to download files using the terminal.

dnf install -y wget

Reboot your system.

reboot

Install VirtualBox on Rocky Linux 8 / CentOS 8 / RHEL 8

Set up VirtualBox repository

Download the Oracle VirtualBox public key.

wget https://www.virtualbox.org/download/oracle_vbox.asc

Import the downloaded Oracle public key to the system.

rpm --import oracle_vbox.asc

Download the VirtualBox repository file for Rocky Linux 8 / CentOS 8 / RHEL 8 from official site and move it into /etc/yum.repos.d/ directory.

wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo

OR

Create a repository /etc/yum.repos.d/virtualbox.repo file with the following information.

ADVERTISEMENT

cat <<EOF >> /etc/yum.repos.d/virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS - 8 x86_64 - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/rhel/8/x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EOF

Install VirtualBox

Install VirtualBox using the yum command.

VirtualBox v6.1

dnf install -y VirtualBox-6.1

VirtualBox v5.x

dnf install -y VirtualBox-5.2

Run the below command to check the status of the VirtualBox Linux kernel module service.

systemctl status vboxdrv

Output:

 vboxdrv.service - VirtualBox Linux kernel module
   Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2021-07-03 00:54:03 EDT; 1min 3s ago
  Process: 10758 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 23360)
   Memory: 0B
   CGroup: /system.slice/vboxdrv.service

Jul 03 00:54:02 rocky8.itzgeek.local systemd[1]: Starting VirtualBox Linux kernel module...
Jul 03 00:54:03 rocky8.itzgeek.local vboxdrv.sh[10758]: vboxdrv.sh: Starting VirtualBox services.
Jul 03 00:54:03 rocky8.itzgeek.local systemd[1]: Started VirtualBox Linux kernel module.

If the service is inactive, then you may need to start the service. 

systemctl start vboxdrv

Access VirtualBox

Goto Activities >> Search for Oracle VM VirtualBox.

Start VirtualBox
Start VirtualBox

OR

virtualbox

What are you waiting for? Just go and create virtual machines.

VirtualBox 6.1 Running Fedora Virtual Machine
VirtualBox 6.1 Running Fedora Virtual Machine

Install Oracle VM VirtualBox Extension Pack

Oracle offers an extension pack to add additional functionalities to VirtualBox like USB 2.0/3.0, VirtualBox Remote Desktop Protocol (VRDP) support, Disk encryption, Host webcam passthrough, Intel PXE boot ROM, and PCI passthrough to the Oracle VM VirtualBox base installation.

NOTE: Install the same version extension pack as your VirtualBox version.

Download the VirtualBox extension pack using the wget command.

### VirtualBox 6.1 ###

cd /tmp

wget https://download.virtualbox.org/virtualbox/6.1.22/Oracle_VM_VirtualBox_Extension_Pack-6.1.22.vbox-extpack

### VirtualBox 5.2.44 ###

cd /tmp

wget https://download.virtualbox.org/virtualbox/5.2.44/Oracle_VM_VirtualBox_Extension_Pack-5.2.44.vbox-extpack

To install the Oracle VM VirtualBox extension pack, go to VirtualBox >> Preference >> Extensions >> browse to the downloded location (/tmp) by clicking on the + icon.

Locate VirtualBox Extension Pack
Locate VirtualBox Extension Pack

Click on the Install button to install the VirtualBox extension pack.

Install VirtualBox Extension
Install VirtualBox Extension

Scroll down the license page to agree to the VirtualBox license.

Agree to VirtualBox License
Agree to VirtualBox License

Upon successful installation, you would see confirmation message below.

VirtualBox Extension Installed Successfully
VirtualBox Extension Installed Successfully

Conclusion

That’s All. You have learned how to install VirtualBox on Rocky Linux 8 / CentOS 8 / RHEL 8. Would you mind sharing your feedback in the comments section?

ADVERTISEMENT

You might also like