#!/bin/bash # Install KVM apt-get install --no-install-recommends \ qemu-system libvirt-clients libvirt-daemon-system ovmf # Remove virbr0 NAT interface created during the kvm installation virsh net-destroy default virsh net-undefine default # Create network from exisiting host bridge cat >/tmp/host-bridge.xml < host-bridge EOL virsh net-define /tmp/host-bridge.xml virsh net-autostart host-bridge virsh net-start host-bridge rm /tmp/host-bridge.xml # Create isolated network (without DHCP) cat >/tmp/isolated-bridge.xml < isolated-bridge EOL virsh net-define /tmp/isolated-bridge.xml virsh net-autostart isolated-bridge virsh net-start isolated-bridge rm /tmp/isolated-bridge.xml # List networks virsh net-list # Allow admin to use libvirt sudo usermod -a -G libvirt admin