Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing VirtualBox and Vagrant on CentOS 7
# Some notes from installing VirtualBox on CentOS 7.
# These exact steps haven't been tested, as I ran them in a different order when manually installing.
# Install dependencies
yum -y install gcc make patch dkms qt libgomp
yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
# Install VirtualBox
cd /etc/yum.repos.d
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
yum install VirtualBox-5.0
# Check that you have the kernel sources downloaded for your running kernel version (if they don't match you might need to yum update and reboot)
ls /usr/src/kernels/
uname -r
# Build the VirtualBox kernel module
export KERN_DIR=/usr/src/kernels/$(uname -r)
/sbin/rcvboxdrv setup
# Install Vagrant
yum -y install https://releases.hashicorp.com/vagrant/1.8.1/vagrant_1.8.1_x86_64.rpm
# Test Vagrant
mkdir ~/test-vagrant
cd ~/test-vagrant
vagrant init ubuntu/trusty64
vagrant up
@farizluqman

This comment has been minimized.

Copy link

farizluqman commented Mar 28, 2018

Installing the kernel-devel alone is not enough, however I'm using this instead
sudo yum -y install "kernel-devel-uname-r == $(uname -r)"

Also check if Perl is installed, if not
sudo yum -y install perl

Then following the rest of the step just fine :)

@thanch2n

This comment has been minimized.

Copy link

thanch2n commented Apr 4, 2018

Run this

yum -y install gcc make patch  dkms qt libgomp
yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
cd /etc/yum.repos.d
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
yum install VirtualBox-5.2 -y
export KERN_DIR=/usr/src/kernels/$(uname -r)
/sbin/rcvboxdrv setup

and get an error on /var/log/vbox-install.log :

/tmp/vbox.0/Makefile.include.header:141: *** Error: unable to find the headers of the Linux kernel to build against. Specify KERN_VER=<version> (currently 3.10.0-327.el7.x86_64) and run Make again...

I solved this by reboot and set correct KERN_VER
export KERN_VER=$(uname -r)

Maybe a reboot before yum install VirtualBox will make everything smoothly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.