The following tutorial is intended to explain the procedure for deploying VirtualBox on a System running CentOS 7. 

Oracle VM VirtualBox: is a free and open-source hosted hypervisor for x86 virtualization, developed by Oracle Corporation. VirtualBox runs on Windows, Linux (Including Ubuntu and CentOS), or macOS as its host OS and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003,  Vista, Windows 7, Windows 8), DOS/Windows 3.x, Linux (2.4, 2.6 and 3.x),  Solaris and OpenSolaris, OS/2, and OpenBSD. For more information please visit Oracle VM VirtualBox


  • Laptop or Baremetal System running CentOS 7 or later
  • Administrative rights to the system
  • Basic Understanding of VirtualBox

Step 1) Creating a Repo and  Importing VBox Public Keys

Create a VirtualBox repo file under the folder “/etc/yum.repos.d”. Copy and Paste the following command in your terminal.

cat <<EOF > /etc/yum.repos.d/virtualbox.repo
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox

Update yum repositories index using “yum repolist” command and press “y” to accept VirtualBox repo keys

sudo yum repolist

Step 2) Installing Essential Packages

install the gcc make perl packages from your distribution. This is needed to et your system up to build kernel modules

sudo yum install gcc make perl -y

Step 3) Install Linux-headers

Next install the Linux kernel “header” files matching the current kernel for adding new hardware support to the system. You can get the kernel number by running the following command.

[root@centosvm01 vagrant]# uname -r

Once you have the kernel number you can search for the distribution containing the headers. If you are unsure, you can run /sbin/vboxconfig, this will attempt to build the kernel module, but fail. In te erro message you will find the names of the packages you need to install. To install the linux-headers.

sudo yum install kernel-devel kernel-devel-3.10.0-1062.1.2.el7.x86_64 -y

Step 4) Install VirtualBox 6.0

Now that we have all the pre-requisites in place, we can install VirtualBox 6.o by running the following command.

yum install VirtualBox-6.0 -y

Step 5) Building the Kernel Modules and Starting VirtualBox

Next, we’ll need to install the VirtualBox Kernel Modules and start the services, You can do this by running the following command.

[root@centosvm01 vagrant]# /sbin/vboxconfig Stopping VirtualBox services. Starting VirtualBox services. Building VirtualBox kernel modules.

VirtualBox is now installed and started. You can check the version with the “vboxmanage” utility

[root@centosvm01 vagrant]# vboxmanage -v

Final Thoughts on Installing VirtualBox 6.0 on CentOS 7

If you’re a Developer, Operator, Designer or just looking to mess around with Virtualization, then VirtualBox is a great tool to get you started. VirtualBox is among the more renowned and wonderful virtualization management software going around and offers some advanced benefits that make using it worth your time.

  • Enable 3D Graphics
  • Leverage Virtual Appliances
  • Bridge Networks
  • Future-proofing using snapshots
  • Virtual Machine Cloning
  • Drag-n-Drop sharing of files and folders
  • phpVirtualBox
  • Guest Additions

Related Blogs

Contact Us