How To Install VirtualBox on CentOS 7

por | 4 febrero, 2019

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.

Prerequisites

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 the VirtualBox on your CentOS 7 machine:

  1. Start by downloading the build tools necessary for compiling the vboxdrv kernel module:sudo yum install kernel-devel kernel-headers make patch gccCopy
  2. Download the Oracle Linux repo file to /etc/yum.repos.d directory using the following wget command:sudo wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -P /etc/yum.repos.dCopy
  3. Install the latest version of VirtualBox 5.2.x by typing:sudo yum install VirtualBox-5.2CopyDuring the installation you will be prompted to import repository the GPG key. Type y and hit 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-1Copy
  4. To verify that your VirtualBox installation was successful, run the following command which will check the status of the vboxdrv service.systemctl status vboxdrvCopyThe 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 agoCopy

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:

wget https://download.virtualbox.org/virtualbox/5.2.20/Oracle_VM_VirtualBox_Extension_Pack-5.2.20.vbox-extpack

Copy

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

Copy

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)?

Copy

Type 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".

Copy

Starting VirtualBox

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:

Conclusion

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 question, please leave a comment below.