This guide shows how to configure Ubuntu 24.04 as a KVM hypervisor with libvirt and Cockpit for web-based virtual machine management.
The installation includes KVM/QEMU, libvirt, networking utilities, Cockpit Machines and several useful system administration tools.
Update Ubuntu
Update the package index before installing the virtualization packages:
Install several useful networking, monitoring and system utilities:
sudo apt install -y net-tools whois cpu-checker nload vlan
Install KVM and Libvirt
Install the KVM/QEMU hypervisor, libvirt and the required bridge networking tools:
sudo apt install -y libvirt-daemon-system bridge-utils qemu-kvm libvirt-daemon virtinst
Verify that hardware virtualization is available:
root@kvm-hyp:~# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
Check the libvirt service:
root@kvm-hyp:~# systemctl status libvirtd
● libvirtd.service - libvirt legacy monolithic daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: enabled)
Active: active (running) since Tue 2026-08-25 11:05:19 UTC; 6 days ago
TriggeredBy: ● libvirtd-ro.socket
● libvirtd.socket
● libvirtd-admin.socket
Docs: man:libvirtd(8)
https://libvirt.org/
Main PID: 2002 (libvirtd)
Tasks: 26 (limit: 32768)
Memory: 97.9M (peak: 128.5M)
CPU: 26.586s
CGroup: /system.slice/libvirtd.service
├─2002 /usr/sbin/libvirtd --timeout 120
├─2363 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
└─2364 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
Install Cockpit Web Management
Install Cockpit together with the Cockpit Machines extension for managing KVM virtual machines:
sudo apt install -y cockpit cockpit-machines
Enable the Cockpit socket and start it immediately:
sudo systemctl enable --now cockpit.socket
Verify that Cockpit is listening:
root@kvm-hyp:~# systemctl status cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; preset: enabled)
Active: active (listening) since Tue 2026-08-25 11:05:18 UTC; 6 days ago
Triggers: ● cockpit.service
Docs: man:cockpit-ws(8)
Listen: [::]:9090 (Stream)
Tasks: 0 (limit: 133962)
Memory: 2.6M (peak: 5.0M)
CPU: 17ms
CGroup: /system.slice/cockpit.socket
Aug 25 11:05:18 kvm-hyp systemd[1]: Starting cockpit.socket - Cockpit Web Service Socket...
Aug 25 11:05:18 kvm-hyp systemd[1]: Listening on cockpit.socket - Cockpit Web Service Socket.
Install additional monitoring, performance tuning and administration utilities:
sudo apt install -y mc iptraf-ng tuned plocate libhugetlbfs-bin cpufrequtils
If UFW is enabled, allow TCP port 9090 for Cockpit web access:
Check the current firewall status:
Open Cockpit
Open the Cockpit web interface in a browser:
Log in using a local Ubuntu user account. The browser may initially display a certificate warning because Cockpit uses a locally generated certificate by default.

Check KVM Virtual Machines
Verify that libvirt is working and display the configured virtual machines:
root@kvm-hyp:~# virsh list --all
Id Name State
----------------------------------
3 test12-vm123-sof running
6 xyz-vm123-sof running
7 guest-vm12-sof running
Virtual machines can now be created and managed either through the Cockpit web interface or directly from the command line using virsh and virt-install.
Useful KVM Hypervisor Commands
kvm-ok
systemctl status libvirtd
systemctl status cockpit.socket
virsh list --all
virsh nodeinfo