Own Your Hypervisor: KVM on Linux Instead of VMware
🤖 Researched and drafted automatically from the official docs, and reviewed before publishing. Commands are taken from the source projects — but always sanity-check before running anything on your own hardware.
VMware’s pricing and licensing model has tightened to the point where self-hosting a hypervisor makes hard financial sense. KVM—the kernel-based virtual machine built into Linux—gives you industrial-grade virtualization without the licensing audit risk. You get full hardware passthrough, live migration, and a rock-solid foundation for a homelab. Here’s how to set it up on bare metal.
Prerequisites
You need:
- A modern x86-64 CPU with virtualization extensions (Intel VT-x or AMD-V). Check with:
If you see output, you’re good.grep -E '(vmx|svm)' /proc/cpuinfo - At least 16 GB of RAM (32 GB is better for running multiple VMs).
- A Linux distribution with kernel support. Ubuntu Server 22.04 LTS or Debian 12 work well.
- A second NIC for bridged networking (optional but recommended to avoid trapping yourself on the host network).
Step 1: Verify Virtualization Support in BIOS
Reboot into BIOS/UEFI and enable virtualization extensions:
- Intel systems: Look for “VT-x” or “Intel Virtualization Technology.”
- AMD systems: Look for “SVM” or “AMD-V.”
Save and boot back into Linux. Confirm the kernel sees it:
kvm-ok
If kvm-ok is not installed, run:
sudo apt update && sudo apt install cpu-checker
You should see: “KVM acceleration can be used.”
Step 2: Install KVM and Management Tools
On Debian/Ubuntu:
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
This installs:
- qemu-kvm: The hypervisor and emulation engine.
- libvirt: The daemon that manages VMs and networking.
- libvirt-clients: Command-line tools (
virsh,virt-install). - bridge-utils: For network bridging.
- virt-manager: Optional GUI, but we’ll use CLI.
Enable and start libvirtd:
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
Add your user to the libvirt group to run VMs without sudo:
sudo usermod -aG libvirt $USER
newgrp libvirt
Step 3: Set Up Bridged Networking (Recommended)
By default, libvirt uses NAT, which works but limits VM connectivity. Bridged networking lets VMs get IPs on your LAN directly.
Identify your primary NIC:
ip link show
Let’s say it’s eth0. Create a bridge by editing /etc/netplan/01-netcfg.yaml (or your distro’s network config):
network:
version: 2
ethernets:
eth0:
dhcp4: false
bridges:
br0:
dhcp4: true
interfaces: [eth0]
Apply:
sudo netplan apply
Verify the bridge is up:
ip addr show br0
Then define the bridge in libvirt. Create /tmp/bridge.xml:
<network>
<name>br0</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
Define and start it:
virsh net-define /tmp/bridge.xml
virsh net-start br0
virsh net-autostart br0
Step 4: Create Your First VM
Download an OS image. For Ubuntu 22.04 LTS:
cd ~/vms
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
Create a VM with 4 vCPUs, 8 GB RAM, and 50 GB disk:
virt-install \
--name ubuntu-test \
--vcpus 4 \
--memory 8192 \
--disk ~/vms/ubuntu-test.qcow2,size=50 \
--network bridge=br0 \
--os-type linux \
--os-variant ubuntu22.04 \
--import \
--graphics none \
--console pty,target_type=serial
This creates a VM and boots it. Once running, connect via:
virsh console ubuntu-test
Press Ctrl+] to exit the console.
Step 5: Manage VMs with virsh
List running VMs:
virsh list
Stop a VM gracefully:
virsh shutdown ubuntu-test
Force stop:
virsh destroy ubuntu-test
Start a VM:
virsh start ubuntu-test
Edit VM config (CPU, RAM, disk):
virsh edit ubuntu-test
Delete a VM and its disk:
virsh undefine ubuntu-test --remove-all-storage
Step 6: Enable Hardware Passthrough (Optional)
For GPU or NIC passthrough, you need IOMMU. Enable it in GRUB:
Edit /etc/default/grub and add to GRUB_CMDLINE_LINUX_DEFAULT:
- Intel:
intel_iommu=on - AMD:
amd_iommu=on
Example:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on"
Update and reboot:
sudo update-grub
sudo reboot
Verify IOMMU is active:
dmesg | grep -i iommu
You should see “IOMMU enabled.” Then use virsh nodedev-list --cap pci to list PCI devices and passthrough them in VM XML.
Step 7: Keep It Secure
- Never expose libvirtd to the network. It’s a local socket only—keep it that way.
- Use a separate VLAN or subnet for your VMs if you’re on a shared network.
- Run libvirtd behind a VPN or on an isolated LAN. Do not allow remote access from the internet.
- Keep the host patched. Run
sudo apt update && sudo apt upgraderegularly. - Use SELinux or AppArmor if your distro supports it; libvirt integrates with both.
Monitoring and Logs
Watch VM resource usage:
virt-top
Check libvirtd logs:
sudo journalctl -u libvirtd -f
View VM logs:
virsh qemu-monitor-command ubuntu-test '{"execute": "query-status"}'
Is It Worth It?
Yes. You get:
- No licensing costs. KVM is part of the Linux kernel—free forever.
- Full control. You own the hypervisor, the config, the VMs, everything.
- Mature tooling. libvirt has been battle-tested in production for 15+ years.
- Portability. Move VMs between KVM hosts via
virsh dumpandvirsh restore. - No vendor lock-in. Your VM configs are standard XML; your disks are QCOW2 or raw images.
The tradeoff: you’re responsible for patching, backups, and troubleshooting. But if you’re already running a homelab, you’re used to that. KVM is simpler than VMware’s licensing maze and just as capable for homelabs and small production setups.
Gear used in this build
* Affiliate links — I earn a small commission at no cost to you.It's gear I use and would genuinely recommend. As an Amazon Associate I earn from qualifying purchases. See the full disclosure.
Related video
New self-hosted AI & homelab shorts, daily.
Subscribe on YouTubeRelated guides
Turn an old webcam into an AI security camera with Frigate
Run Frigate NVR on a spare PC to detect people, cars, and animals in real-time from cheap IP cameras or old USB webcams. Local processing, no cloud, integrates with Home Assistant.
Turn a $15 Android TV Box into an Armbian Linux Server
Flash Armbian on Amlogic S905/S922 TV boxes to run Docker, Pi-hole, and other services. Boot from USB first—eMMC flashing can brick it.
Turn an Old Laptop into a Home Server with CasaOS
Install CasaOS on Debian/Ubuntu with one command and get a click-install app store for Jellyfin, Nextcloud, Home Assistant. Runs on x86 and ARM.