How to install VirtualBox on CentOS 5/6/7

It may have been explained clearly in the official VirtualBox VirtualBox Linux Download on how to install VirtualBox on CentOS 5/6/7, but for some new CentOS users it may be confusing.

In this brief post, I will try to make it simpler and faster to install VirtualBox on CentOS 5/6/7 using yum utility. Let’s follow the instructions below!

Download virtualbox.repo

wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
sudo mv virtualbox.repo /etc/yum.repos.d/

Install the VirtualBox

sudo yum install VirtualBox-5.0
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.sonic.net
 * extras: mirrors.psychz.net
 * updates: mirrors.cat.pdx.edu
Resolving Dependencies
--> Running transaction check
---> Package VirtualBox-5.0.x86_64 0:5.0.0_101573_el7-1 will be installed

[snipped]

Installed:
  VirtualBox-5.0.x86_64 0:5.0.0_101573_el7-1                                                                                                                                   

Complete!

Once VirtualBox is completely installed, you are ready to install and setup Vagrant.