How to install KVM on Ubuntu 20.04 LTS Headless Server

KVM (Kernel-based Virtual Machine) is an open-source virtualization technology that allows you to run multiple virtual machines on a single physical server. Here’s how you can install KVM on an Ubuntu 20.04 LTS headless server:

  1. First, update the package repository by running the command “sudo apt update”
  2. Next, install the KVM package and other required packages by running the command “sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils”
  3. Once the installation is complete, check if the KVM module is loaded by running the command “sudo lsmod | grep kvm”
  4. If the KVM module is not loaded, load the module by running the command “sudo modprobe kvm”
  5. Next, check the status of the libvirtd service by running the command “sudo systemctl status libvirtd”
  6. If the service is not running, start the service by running the command “sudo systemctl start libvirtd”
  7. To enable the service to start automatically at boot time, run the command “sudo systemctl enable libvirtd”
  8. Finally, add the user to the libvirtd group by running the command “sudo usermod -aG libvirtd <username>”

Once the installation is complete, you can use the command-line tool “virsh” to manage the virtual machines, and you can use the “virt-install” command to create new virtual machines.

It’s important to note that, if you want to use a bridge network, you need to configure a bridge interface, you can use the command “sudo brctl addbr br0” to create a new bridge

Leave a Comment