How To Install VirtualBox on CentOS 7 / RHEL 7
VirtualBox is an open-source hypervisor software that helps you create and run multiple guest operating systems (“virtual machines”) on a single hardware machine. VirtualBox can be installed on host operating systems, including Linux, Windows, Solaris, OS X, and OpenSolaris.
From version 2.0, VirtualBox supports 32 and 64bit host and guest operating systems. If you want to install 64bit guests, then your processor must support hardware virtualization, and, of course, the host operating system must be 64bit as well.
VirtualBox is released under GPL v2 and Oracle VM VirtualBox extension pack is released under PUEL (Personal Use and Evaluation License).
This tutorial shows how to install VirtualBox on CentOS 7 / RHEL 7.
Prerequisites
Update System
Update the system to the latest version.
yum update -y
Install Development Tools
Once the system is up, install header and development tools.
yum install -y kernel-devel kernel-headers gcc make perl
Also, install the wget package to download items using the terminal.
yum -y install wget
Reboot the system.
reboot
Install VirtualBox on CentOS 7 / RHEL 7
Set up VirtualBox repository
Download the Oracle public key.
wget https://www.virtualbox.org/download/oracle_vbox.asc
Import the Oracle public key.
rpm --import oracle_vbox.asc
Download the VirtualBox repository file for CentOS 7 / RHEL 7 and move it into /etc/yum.repos.d/
directory.
wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
OR
Create the /etc/yum.repos.d/virtualbox.repo
file with the following repository information.
[virtualbox] name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox baseurl=https://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
Install VirtualBox
Install VirtualBox using the yum
command.
VirtualBox v6.0
yum install -y VirtualBox-6.0
VirtualBox v5.2
yum 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 Wed 2019-11-20 02:46:52 EST; 29s ago Process: 6389 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS) Tasks: 0 Nov 20 02:46:52 centos7.itzgeek.local systemd[1]: Starting VirtualBox Linux k... Nov 20 02:46:52 centos7.itzgeek.local vboxdrv.sh[6389]: vboxdrv.sh: Starting ... Nov 20 02:46:52 centos7.itzgeek.local systemd[1]: Started VirtualBox Linux ke... Hint: Some lines were ellipsized, use -l to show in full.
Access VirtualBox
Start VirtualBox: Application >> System Tools >> Oracle VM VirtualBox.

OR
virtualbox
What are you waiting for? just go and create virtual machines.


Install Oracle VM VirtualBox Extension Pack
Oracle offers an extension pack to add additional functionalities such as USB 2.0/3.0, VirtualBox Remote Desktop Protocol (VRDP) support, Disk encryption, Host webcam passthrough, Intel PXE boot ROM, and PCI passthrough.
Download the Oracle VM VirtualBox extension pack using the wget command.
### VirtualBox 6.0 ### cd /tmp wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack ### VirtualBox 5.2.22 ### cd /tmp wget https://download.virtualbox.org/virtualbox/5.2.34/Oracle_VM_VirtualBox_Extension_Pack-5.2.34.vbox-extpack
To install the extension pack, go to VirtualBox >> Preference >> Extensions >> browse for extension pack (/tmp) by clicking on the + icon.

Click on the Install button to install the VirtualBox extension pack.
Accept the VirtualBox license to start the installation.
Conclusion
That’s All. You have successfully installed VirtualBox on CentOS 7 / RHEL 7. Please share your feedback in the comments section.