This article demonstrates how to install VirtualBox on CentOS 7 and RHEL systems.
cd /etc/yum.repos.d/ wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo rpm -Uvh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
Install required packages:
yum install gcc make patch dkms qt libgomp yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
Check where the kernel headers went. We need that for a “path” change shortly.
ls -l /usr/src/kernels/
I got the following:
3.10.0-327.36.3.el7.x86_64
Set a temporary path using the above result:
export KERN_DIR=/usr/src/kernels/3.10.0-327.36.3.el7.x86_64
Now install the VirtualBox packages:
yum install VirtualBox-5.1
At this point you will be asked which user you want to authenticate as. But if you’re setting up VirtualBox for use with Vagrant, you can end this process right here.
However, if you’re not doing this for Vagrant, continue on with the following command:
systemctl restart vboxdrv