Introduction

Oracle VirtualBox is a virtualization software solution that allows you to create and run virtual machines on a single hardware machine. By using a Type 2 hypervisor, like VirtualBox, your existing operating system stays unaffected by the virtual environment.

This guide outlines how to install VirtualBox on CentOS 7.

tutorial on installing VirtualBox on CentOS 7

Prerequisites

  • Access to a terminal window (Crtl+Alt+T)
  • A user with sudo privileges
  • CentOS with GUI

Installing VirtualBox 6.0 From Oracle Repositories on CentOS

Prepare your system by updating the current CentOS 7 installation using the command:

sudo yum update

Step 1: Install vboxdrv Kernel Module

VirtualBox uses the vboxdrv kernel module to control and allocate physical memory for the guest operating systems.

To install additional modules (kernel-devel, dkms, kernel-headers, wget, and other dependency packages) enter:

sudo yum install –y patch gcc kernel-headers kernel-devel make perl wget

Once the installation is complete, reboot your system to start using the new kernel:

sudo reboot

Step 2: Download VirtualBox Repository

To download the VirtualBox Oracle repository enter:

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

The command downloads the repository file and places it in the /etc/yum.repos.d directory.

Confirmation of downloading and saving the virtualbox repository file

Step 3: Install VirtualBox 6.0

Install VirtualBox 6.0 from the downloaded repository:

sudo yum install VirtualBox-6.0

The system prompts you to accept the GPG key. Enter y to confirm.

After the installation has finished, check the status of the VirtualBox Linux kernel module service:

sudo systemctl status vboxdrv

The output confirms that the service is active, and provides a timestamp.

Image shows that VirtualBox Linux kernel module is active with date and time

Step 4: Install Oracle VirtualBox Extension Pack (Optional)

Additional packs for functions like the use of USBs, remote desktop protocols, or disk encryption need to be installed separately.

To download the extension VirtualBox pack, enter:

wget http://download.virtualbox.org/virtualbox/6.0.4/Oracle_VM_VirtualBox_Extension_Pack-6.0.4.vbox-extpack

The terminal confirms that the packs have been downloaded.

extension pack is saved to the correct file

Next, import the pack to VirtualBox:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.4.vbox-extpack

Confirm that you agree to the terms and conditions with y. The system confirms the successful installation of the extension pack.

Confirmation that the extension pack is installed sucessfully

Step 5: Start VirtualBox

To access the newly installed VirtualBox, use the command:

VirtualBox

The VirtualBox manager interface will prompt you:

oracle VM VirtualBOX Manager welcome page

Alternatively, you can use the graphical interface and access the application:

Application >> System Tools >> Oracle VM VirtualBox

Conclusion

By following these instructions, you have learned how to install VirtualBox on your CentOS 7 system.

VirtualBox provides a simple, cost-effective method for setting up multiple virtual environments. Always consider the physical limitations of memory and processing power of your host machine.