Kvmrun is a suite of tools providing a CLI and gRPC interface for creating and managing virtual machines. Built for hosting providers who need hot-plug devices, live migration, and block backups.
From hot-plugging devices to live migration, Kvmrun simplifies the most essential tasks for cloud service providers.
Create, edit, start and stop VMs via command line or the full-featured gRPC API with mutual TLS authentication.
Attach and detach block, network, and PCI devices without restarting virtual machines.
Migrate running VMs between hosts -- with or without local storage, or with a specified list of block devices.
Full and incremental block backups to protect your virtual machine data.
Access the guest virtual console (hvc0) and VNC console for interactive management.
Pass through host PCI devices via vfio-pci for GPU acceleration and other hardware access.
Configure CloudInit drives and build CloudInit ISO images for automated VM provisioning.
Configure and manage UEFI firmware for modern boot scenarios.
Limit CPU resources via cgroups (v1 and v2) and IO operations via QEMU for fair scheduling.
Use the included vnetctl tool to create network bridges, VxLAN tunnels, VLANs and custom network schemes.
Use VSock devices for efficient host-guest communication without exposing network ports.
Run VMs with an external kernel and initrd, plus an ISO-file with modules (Linux-specific).
Kvmrun uses Systemd to orchestrate virtual machines, providing isolation, reliability, and easy lifecycle management.
Each VM is managed as a systemd unit. Systemd handles starting, stopping, and proper cleanup by invoking the appropriate Kvmrun utilities.
Every QEMU process runs in its own personal chroot environment as an unprivileged user -- minimizing the blast radius of any single VM.
All exposed functions are defined in .proto files under the api directory. Communication uses a secure TCP port (TLS) or an abstract UNIX socket with mutual TLS authentication.
Create your first Debian virtual machine from scratch.
Follow the installation instructions below, and make sure QEMU is installed if you built from source.
Use the included script to create a Debian guest image:
$ /usr/share/kvmrun/mk-debian-image -t bullseye-slim$ losetup -f --show debian-bullseye-slim.img
/dev/loop0$ vmm create-conf --mem 2048 --cpu 2-4 alice
$ vmm storage attach alice /dev/loop0Launch the VM and access it via VNC:
$ vmm start alice
$ vmm list
Name PID Mem(MiB) CPUs State Time
alice 32531 2048/2048 2/4 running 34s
$ vmm vnc activate alice
Password: ofKajev5
Display/Port: 1024/6924Available as pre-built packages for Debian/Ubuntu, or build from source.
Install the repository and package in two commands:
$ curl -s https://packagecloud.io/install/repositories/0xef53/kvmrun/script.deb.sh | sudo bash
$ sudo apt-get install kvmrunRequires make, git, and docker-ce:
$ git clone https://github.com/0xef53/kvmrun.git
$ cd kvmrun
$ make && make install
# Generate certificates and start the server
$ /usr/lib/kvmrun/gencert
$ systemctl enable kvmrund.service
$ systemctl start kvmrund.serviceKvmrun works with QEMU 3.1.x and above. Below are tested combinations: