Linux Kernel Virtual Machine setup with QEMU/KVM - Mon, Mar 10, 2025
This document is paired with a video linked below. Let's setup KVM on Linux.
So you want to have you own cloud VM server, correct? Let’s go through all of requirements with Debian 12 as our KVM baseline.
Here are all of the commands that you are going to use that were described in the video:
# This is what you need to install on the HOST
sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system virtinst bridge-utils ovmf dnsmasq qemu-utils
# add your main user to the correct group on the HOST
adduser <youruser> libvirt
# check if KVM is operational
virsh list --all
# generate passwordless SSH connection from your own Linux PC towards the clour VM server
ssh-keygen -t rsa -b 4096
ssh-copy-id darth@192.168.99.13
# use this in the virt-manager to connect to your clour VM server after the previous step and preferably after having the final IP address on the VM server
qemu+ssh://darth@192.168.99.13/system
# Edit your networking configuration on the VM host
sudo nano /etc/network/interfaces
# remove the configuration for your physical NIC, whichever it is and then make the bridge interface
auto br0
iface br0 inet dhcp
bridge_ports eth0 # replace eth0 with your physical NIC name
bridge_stp off
bridge_fd 0
bridge_maxwait 0
# Install the bridge interface into the VM server
sudo virsh net-define /dev/stdin <<EOF
<network>
<name>br0</name>
<forward mode='bridge'/>
<bridge name='br0'/>
</network>
EOF
# And then make it operational
sudo virsh net-start br0
sudo virsh net-autostart br0
# Go to the folder where your VM images will be and get the installer for your first GUEST
sudo wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.9.0-amd64-netinst.iso
DO NOT copy paste the entire block, but watch the video instead and understand which command goes to which server/client machine.
Please watch the acompanying video on your prefered video platform:
- PeerTube: https://tux-edu.tv/w/uUEnafzPYg1wjUJ1QqnGxX
- Odysee: https://odysee.com/@LinuxRenaissance:1/kvm:1
- YouTube: https://youtu.be/l32AhH9NNUE