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:
- First, update the package repository by running the command “sudo apt update”
- 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”
- Once the installation is complete, check if the KVM module is loaded by running the command “sudo lsmod | grep kvm”
- If the KVM module is not loaded, load the module by running the command “sudo modprobe kvm”
- Next, check the status of the libvirtd service by running the command “sudo systemctl status libvirtd”
- If the service is not running, start the service by running the command “sudo systemctl start libvirtd”
- To enable the service to start automatically at boot time, run the command “sudo systemctl enable libvirtd”
- 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