VirtualBox on Virtualization hosts (e.g. RHEL / CentOS, Windows)


some of us ran or will run into the problem that we couldn’t / cannot use VirtualBox because of another hypervisor on our machine. Instead of following recommendations like

  • patch your kernel
  • blacklist kvm
  • use nested virtualization

there is another possibility. That’s libvirt. Libvirt is an API that can work with hypervisors like Hyper-V, KVM/QEMU. And there is a libvirt plug-in for vagrant.

That’s how I built the same working virtual MongoDB-Server with all the software and scripts provided in this course on RHEL7 with the provided handouts (the only difference is, that it doesn’t use VirtualBox):

  1. Install libvirt and libvirt-devel. (libvirt without -devel should already be installed on a RHEL/CentOS virtualization host.)
  2. Install the libvirt plug-in for vagrant: vagrant plugin install vagrant-libvirt
  3. Change the Vagrantfile:

Set the server.vm.provider from “virtualbox” to “:libvirt” (Don’t forget the “:”)
Remove the following lines:
vb.customize [“modifyvm”, :id, “–cpus”, “2”] = “mongod-m103”

Destroy an eventually created VM mongod-m103 with: vagrant destroy mongod-m103
Remove VirtualBox.

Proceed as described in the course.
You may see a message about the “wrong” VirtuaBox guest additions … yes. Obviously. But I didn’t want to adapt the other script too and shared folders work.

Libvirt is also available for Windows, but I didn’t test it.

Good luck!

1 Like