Install Virtualbox – CentOS 7

Virtualbox is great, it let’s you run multiple operating systems on one machine while being completely free.

You’ll need to start off by installing some prerequisites, issue the following at shell:

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

We now need to setup the environment variable KERN_DIR, navigate to /usr/src/kernels and see which ones you have listed, if this is a new server you should only have one. Copy the complete name and form the command below:

export KERN_DIR=/usr/src/kernels/3.10.0-229.20.1.el7.x86_64

Download the rpm for Virtualbox from https://www.virtualbox.org/wiki/Linux_Downloads

wget http://download.virtualbox.org/virtualbox/5.0.10/VirtualBox-5.0-5.0.10_104061_el7-1.x86_64.rpm

To install, navigate to the above directory and issue the following:

yum install VirtualBox-5.0-5.0.10_104061_el7-1.x86_64.rpm

Issue the following:

/usr/lib/virtualbox/vboxdrv.sh setup

Now start Virtualbox and create your virtual machine.