Home VPN WorkPlace Web Sites/Apps Small Business Other Apps Contact Guides

Ubuntu Server & KVM: Headless

This will require an other machine with Ubuntu Desktop with KVM GUI installed to easily create and manage VMs remotely.

Source A: https://www.cyberciti.biz/faq/how-to-install-kvm-on-ubuntu-20-04-lts-headless-server/

Source B: https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/

Install KVM & Tools

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients virtinst cpu-checker libguestfs-tools libosinfo-bin -y

Setup Network Bridge

Edit network settings
First locate your netplan yaml file
ls /etc/netplan
You will see a file like: 50-cloud-init.yaml
Now Edit that file.
sudo nano /etc/netplan/50-cloud-init.yaml
network: version: 2 ethernets: eth0: dhcp4: false dhcp6: false bridges: br0: interfaces: [eth0] dhcp4: true dhcp6: false
Now Verify & Apply
First check for errors using:
sudo netplan generate
If there are no errors...
sudo netplan apply

Management Client Setup


Other Useful Information

VM guest config file location.
ls /etc/libvirt/qemu

List VMs
virsh list --all
Start VM
virsh start [vmname]
Shutdown VM
virsh shutdown [vmname]
Save State
virsh managedsave [vmname]
Change Saved State Location
sudo rmdir /var/lib/libvirt/qemu/save
sudo ln -s /[new location]/save /var/lib/libvirt/qemu

Export VM Config (Note: Storage images need to be copied manually)
virsh dumpxml [vmname] > /[location]/[vmname].xml
Import VM Config (Note: Storage images need to be copied manually)
sudo virsh define /[location]/[vmname].xml