Install KVM Hypervisor on Debian 12|11|10



In this guide, we will learn how to Install KVM Hypervisor Virtualization server on Debian. KVM (Kernel-based Virtual Machine) is an open source full virtualization solution for Linux Systems running on x86 hardware with virtualization extensions (Intel VT or AMD-V).

For other systems: How to install KVM on Fedora, RHEL/CentOS 8, Ubuntu

KVM requires that you have the CPU on your computer which has a function Intel VT or AMD-V. KVM consists of a loadable kernel module,kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko.

Install KVM / QEMU on Debian 12|11|10
Follow the steps below to install KVM Virtualization on Debian Linux system. All KVM packages for Debian are available on upstream repositories. The apt package manager is used for all packages installation.

sudo apt update
sudo apt -y install qemu-kvm libvirt-daemon bridge-utils virtinst libvirt-daemon-system

Load and enable the vhost_net module.

Let’s also install useful Virtual Machine management tools.

sudo apt -y install vim libguestfs-tools libosinfo-bin qemu-system virt-manager

This will give you tools similar to Linux ls, cat, top command for use with Virtual Machines.

Create KVM Bridge on Debian (Optional)
For your Virtual Machines to talk to the outside world, a Linux bridge is required. Installation of KVM on Debian 11|10 creates a Linux bridge called virbr0. This can be used for all test environments.

But if you want to your VMs to be accessible over the network, you’ll need to create a bridge on physical network interface attached to your machine.

Create one on your Debian server/workstation like below.

sudo vim /etc/network/interfaces

My bridge configuration uses a network interface (ens33) to create a Linux bridge called br1. Replace the values provided with yours.

# Primary network interface
auto eno1
iface eno1 inet manual

# Bridge definitions
auto br0
iface br0 inet static
bridge_ports eno1
bridge_stp off

Reboot your machine for the network configuration changes to take effect.

sudo reboot
Confirm ip network details.

$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether 1c:69:7a:61:da:e9 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
3: wlp0s20f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 08:71:90:27:5b:be brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 26:8f:ab:9f:8b:85 brd ff:ff:ff:ff:ff:ff
inet brd scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::248f:abff:fe9f:8b85/64 scope link
valid_lft forever preferred_lft forever

Create Virtual Machine on KVM
You can use Virtual Machine Manager GUI to create an instance on KVM or via virt-install command line tool.

For virt-install, installation snippet is shared below.

sudo virt-install \
–name deb12 \
–ram 2048 \
–vcpus 2 \
–disk path=/var/lib/libvirt/images/deb12-vm.qcow2,size=20 \
–os-type linux \
–os-variant debian12 \
–network bridge=br0 \
–graphics none \
–console pty,target_type=serial \
–location ‘’ \
–extra-args ‘console=ttyS0,115200n8 serial’

This will download kernel and initrd image before starting installation.

deb installer kvm

The installation process will start shortly. Follow installation prompts for Debian system on KVM.

deb installer kvm 02
deb installer kvm 03
Using Cockpit Web Console

Cockpit enables you to manage your instances and Podman containers from a web console. Install it by running the following commands:

sudo apt install cockpit cockpit-machines cockpit-podman
Then start and enable the service.

sudo systemctl enable cockpit.socket && sudo systemctl start cockpit.socket
Confirm service status:

$ systemctl status cockpit.socket
● cockpit.socket – Cockpit Web Service Socket
Loaded: loaded (/lib/systemd/system/cockpit.socket; enabled; preset: enabled)
Active: active (running) since Wed 2023-08-23 05:48:48 EDT; 11min ago
Triggers: ● cockpit.service
Docs: man:cockpit-ws(8)
Listen: [::]:9090 (Stream)
Tasks: 0 (limit: 28431)
Memory: 84.0K
CPU: 9ms
CGroup: /system.slice/cockpit.socket

Aug 23 05:48:48 systemd[1]: Starting cockpit.socket – Cockpit Web Service Socket…
Aug 23 05:48:48 systemd[1]: Listening on cockpit.socket – Cockpit Web Service Socket.
Access cockpit web interface on https://server-ip-address:9090

cockpit debian
We also have a guide on Virtual Machine’s installation on KVM with Terraform.

Also check related KVM articles:

Добавить комментарий