How to Install VirtualBox on CentOS 7
3 min read
VirtualBox is an open-source cross-platform virtualization software which allows you to run multiple guest operating systems (virtual machines) simultaneously.
In this tutorial, we will show you how to install VirtualBox from the Oracle repositories on CentOS 7 systems.
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges .
Installing VirtualBox from Oracle repositories
Follow the steps below to install VirtualBox on your CentOS 7 machine:
Start by downloading the build tools necessary for compiling the
sudo yum install kernel-devel kernel-devel-$(uname -r) kernel-headers kernel-headers-$(uname -r) make patch gcc
Download the Oracle Linux repo file to
/etc/yum.repos.ddirectory using the following wget command :
sudo wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -P /etc/yum.repos.d
Install the latest version of VirtualBox 5.2.x by typing:
sudo yum install VirtualBox-5.2
During the installation, you will be prompted to import repository the GPG key. Type
Enter. Once the installation is complete you will see the following output:
Creating group 'vboxusers'. VM users must be member of that group! Verifying : VirtualBox-5.2-5.2.20_125813_el7-1.x86_64 Installed: VirtualBox-5.2.x86_64 0:5.2.20_125813_el7-1
To verify that your VirtualBox installation was successful, run the following command which will check the status of the
systemctl status vboxdrv
The output should look something like this indicating that the service is enabled and active :
● 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 provides several useful functionalities for guest machines such as virtual USB 2.0 and 3.0 devices, support for RDP, images encryption and more.
At the time of writing this article, the latest version of VirtualBox is 5.2.20. Before downloading the extension pack using the command below you should check the VirtualBox download page to see if a newer version is available.
Download the extension pack file by typing:
When the download is completed import the extension pack using the following command:
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack
You will be presented with the Oracle license and prompted to accept the terms and conditions.
Do you agree to these license terms and conditions (y/n)?
y and hit
Enter. Once the installation is completed you will see the following output:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully installed "Oracle VM VirtualBox Extension Pack".
Now that you have VirtualBox installed on your CentOS system you can start it either from the command line by typing
VirtualBox or by clicking on the VirtualBox icon (
Applications -> System Tools -> Oracle VM VirtualBox).
When the VirtualBox is started for the first time, a window like the following should appear:
You have learned how to install VirtualBox on your CentOS 7 machine. You can now install your first Windows or Linux guest machine. To find more information about VirtualBox visit the official VirtualBox documentation page.
If you have any questions, please leave a comment below.