<> = kvm = == Debian bookworm == {{{#!highlight sh sudo apt update sudo apt upgrade egrep -c '(vmx|svm)' /proc/cpuinfo grep -E --color '(vmx|svm)' /proc/cpuinfo sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon sudo apt install virt-manager -y sudo virsh net-list --all sudo virsh net-start default sudo virsh net-autostart default sudo modprobe vhost_net lsmod | grep vhost ip a | grep wlp2s0 /sbin/ifconfig sudo nano /etc/network/interfaces # add an IP in the network range auto br0 iface br0 inet dhcp bridge_ports wlp2s0 sudo systemctl restart networking.service # create VM disk sudo qemu-img create -f qcow2 /tmp/netbsd.qcow2 8G cd /tmp/ wget https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/images/NetBSD-9.3-amd64.iso sudo virt-install \ --virt-type kvm \ --name Netbsd \ --ram 2024 \ --disk /tmp/netbsd.qcow2 \ --network network=default --graphics vnc,listen=0.0.0.0 \ --noautoconsole \ --os-variant=generic \ --cdrom=/tmp/NetBSD-9.3-amd64.iso sudo virsh list --all sudo apt install tigervnc-viewer sudo virsh vncdisplay Netbsd :0 vncviewer & # connect to :0 sudo virsh list --all sudo virsh start Netbsd sudo virsh list --all sudo virsh vncdisplay Netbsd vncviewer # see all the installed VMs sudo virsh list --all # Stop running VM sudo virsh stop Netbsd # start sudo virsh start Netbsd # save the state of a VM sudo virsh save Netbsd Netbsd-save # restore a saved VM sudo virsh restore Netbsd-save # reboot sudo virsh reboot Netbsd # suspend VM sudo virsh suspend Netbsd # resume sudo virsh resume Netbsd # shutdown sudo virsh shutdown Netbsd # delete sudo virsh destroy Netbsd # Uninstall sudo apt remove qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager tigervnc-viewer sudo apt autoremove }}}