How to install Virtualbox on CentOS 7/6/5 Linux

VirtualBox on CentOS 7 or 6 or 5 Linux can be used to create different virtual machines for testing and learning purpose. The usage of open source VirtualBox will be the same for Windows, macOS or Linux, the only discrepancies you will find is in the installation process. Thus, here is the step by step guide to install Virtualbox software latest version on CentOS or RedHat Linux.

Install VirtualBox on CentOS

The below-given steps are performed on CentOS 7 Linux but will be the same for CentOS 6. For CentOS 5, the difference will be the VirtualBox repository.

1. Open Command Terminal

If you are using CentOS command line version then you can move to the next step. For GUI users, go to Applications and search for Terminal and click on Konsole.


2: Download & Add VirtualBox Repository on CentOS

Next step to install VirtualBox is to add its official repository in CentOS 6/7 or RedHat 6/7.

Note: root user access is compulsory to use the below commands.

For that first switch to repo directory using below command:

cd /etc/yum.repos.d/

After that download the Oracle VirtualBox repo:


For CentOS 5 or RHEL 5

rpm -Uvh epel-release-5-4.noarch.rpm

3. Run CentOS update command

As we run the update command to flush the cache and let the system to know about the newly added repository, it will ask us to accept the Oracle Corporation (VirtualBox archive signing key), press Y key and let the system perform the update process.

yum update

4. Install a few other packages on CentOS/Redhat

To make the VirtualBox fully workable in order to install and run different virtual machines, we need to install some other modules using the below command:

yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

5. Install VirtualBox 6.0

Finally, everything is prepared and now run the below command for downloading and installing VirtualBox 6 on CentOS or RedHat Linux. Official website to download the same.

Note: The command is case sensitive. If you ignore it then you will get an error “no package virtualbox 6 0 available“.

yum install VirtualBox-6.0

6. Run VirtualBox

Go to the applications of CentOS and search for Virtual Box, as it appears, click on it to run.


The way we create Virtual Machines on any other operating system using this open-source virtualization tool in the same do here.


Uninstall VirtualBox on Centos

To uninstall the installed VBOX simply use the below command, if you don’t require this open-source virtualization tool anymore. Also, this command option is case sensitive.

yum remove VirtualBox*  

Other How-Tos