Ensure your CPU supports hardware virtualization:
egrep -c "(vmx|svm)" /proc/cpuinfo
If the output is greater than 0, virtualization is supported.
sudo apt update sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y
sudo usermod -aG libvirt $USER newgrp libvirt
Log out and back in for the group change to take effect.
sudo systemctl enable --now libvirtd sudo systemctl status libvirtd
virsh list --all
Should show an empty VM list (no errors = working).
Download an ISO and use virt-install to create a VM:
sudo virt-install \\ --name ubuntu-vm \\ --ram 2048 \\ --disk size=20 \\ --cdrom /path/to/ubuntu.iso \\ --os-variant ubuntu22.04
virsh start ubuntu-vm # Start a VM
virsh shutdown ubuntu-vm # Graceful shutdown
virsh destroy ubuntu-vm # Force power off
virsh undefine ubuntu-vm # Delete VM
virsh list --all # List all VMs
If you have a desktop environment, install virt-manager for a graphical interface to create and manage VMs. Launch it from the terminal:
virt-manager