What is the difference between QEMU, KVM, Libvirt, and how to use with Vagrant? Are all 3 needed to work together?
Asked Answered
O

1

28

I've used Vagrant with Virtualbox before but VB is not working on this computer so I thought I would try a different approach, but I can't quite make sense of this cluster of software, what their uses are individually and interdependently... I know Vagrant boxes can have QEMU or Libvirt (or KVM?) providers, and there's qemu, and qemu-kvm, and vagrant-libvirt, and I just can't compartmentalize it all and their interconnection. I want to run virtual machines with synchronized folders on my host. Are all those required, and how? If not, why and how would one use all together? So I can better understand. On Debian 10

Oops answered 28/3, 2020 at 21:17 Comment(2)
It might be helpful for you to get VirtualBox up and running since you already seem more familiar with it.Trujillo
Related: serverfault.com/questions/208693/…Photomural
T
44

Differences between QEMU, KVM, and Libvirt

QEMU is a machine (hardware) emulator.

KVM is a kernel module for Linux to enable virtualization; this is the hypervisor.

QEMU can run without KVM but it can be quite a bit slower.

libvirt is a virtualization library which wraps QEMU and KVM to provide APIs for use by other programs, such as Vagrant, which is a tool for creating virtualized development environments.

Summary:

  • Vagrant uses libvirt.
  • libvirt uses QEMU and KVM.

How to use with Vagrant

First be sure to install the required dependencies:

apt-get build-dep vagrant ruby-libvirt
apt-get install qemu libvirt-daemon-system libvirt-clients ebtables dnsmasq-base
apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev

Source: https://github.com/vagrant-libvirt/vagrant-libvirt#installation

Then use the following command to run:

vagrant up --provider=libvirt

Or, use an environment variable instead:

export VAGRANT_DEFAULT_PROVIDER=libvirt

Source: https://github.com/vagrant-libvirt/vagrant-libvirt#start-vm

Trujillo answered 20/4, 2020 at 13:58 Comment(4)
This is a great sum up! Thank you!Conceivable
Nice summary. How does virtualbox or vmware fit in there?Wowser
Replace QEMU and KVM with either VirtualBox or VMware; both are hypervisors that come with their own drivers.Trujillo
How does VMM (virtual machine manager) and virt-manager fit into this? Are they the hypervisor, the hypervisor GUI compared to KVM as the hypervisor CLI? Would a virtual machine running on the hypervisor KVM be called a VM then?Schrick

© 2022 - 2024 — McMap. All rights reserved.