VirtualBox is an Open Source tool, known as a cross-platform virtualization application or software. It used to run multiple operating systems or virtual machines simultaneously on a single hardware.
In this VirtualBox installation tutorial, we will explain the process to install VirtualBox in CentOS 7 machine using two different methods. The first method describes the steps to install the latest version of VirtualBox from the CentOS repository. The second method will explain the steps to install VirtualBox from the Oracle repository.
The VirtualBox package is available in the CentOS repository, which may is not always the latest version of VirtualBox, as it updated on a time interval. However, if we want to install the latest version of VirtualBox, always use to Oracle repository.
The same instruction will apply to any other Red Hat-based distribution like Linux Mint and Elementary OS.
Before starting this tutorial, make sure you have CentOS 7 Linux installed and having user access with sudo privileges to execute administrative commands.
Installing VirtualBox from CentOS Repository
The VirtualBox installation using the CentOS repository is very straightforward like any other application; just run the following command to install VirtualBox on CentOS system:
$ sudo yum update $ sudo yum install virtualbox virtualbox-ext-pack
Installing VirtualBox on CentOS using Oracle Repository
You can check the VirtualBox download page to get the latest version of VirtualBox available. It will help you to get the latest version of VirtualBox on your CentOS System.
You need to follow the following steps to install the latest version of VirtualBox from the Oracle repositories:
- Step 1 – In the first step, we need to build tools for compaling vboxdrv kernel module to your CentOS system by using the following wget command:
$ sudo yum install kernel-devel kernel-devel-$(uname -r) kernel-headers kernel-headers-$(uname -r) make patch gcc
Step 2 – Now, downlod the oracle linux repository file to /etc/yum.repos.d/ directory using the wget command, as shown below:
$ sudo wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -P /etc/yum.repos.d
Step 3 – Once the VirtualBox’s Oracle repository gets enabled in your CentOS system. You can install VirtualBox like any other application after update the apt package list as shown below:
$ sudo apt update $ sudo apt install virtualbox-6.0
Step 4 – You can verify VirtualBox installation by checking the status of vboxdrv service, as shown below:
$ 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 Thu 2018-10-25 21:31:52 UTC; 6s ago
Installing VirtualBox Extension Pack
The VirtualBox Extension pack is use to enable several useful functionalities for a guest operating system or virtual machines such as USB device support, RDP support, and many more.
You can download VirtualBox Extension pack files by using the following command:
$ wget https://download.virtualbox.org/virtualbox/6.0.0/Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack
You only make sure to match the version of the extension pack with installed VirtualBox.
After completion of the extension pack file download, need to import the extension pack using the following command:
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.0.0.vbox-extpack
Your screen will be prompted with Oracle license with accepting their terms and condition, as shown below:
Output: Do you agree to these license terms and conditions (y/n)?
You should type “y” and hit the Enter button; after completion of VirtualBox installation, your screen will give you the following output:
Output: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack".
There are two ways to start VirtualBox; one is to using command by typing the command “VirtualBox.” Another one is to click on the VirtualBox icon using GUI, which appears in the Applications -> System Tools -> Oracle Vm VirtualBox.
When you start VirtualBox first time in your CentOS system, you will get the output screen similar to the below one:
Using this tutorial article, you have learned to install VirtualBox on your CentOS 7 Linux machine using the CentOS repository and Oracle VirtualBox repository. You can learn more about the VirtualBox using the official VirtualBox Documentation page.
If you have any issue in installing VirtualBox or having any feedback, please leave a comment below.