apt install qemu-kvm qemu-system qemu-utils
apt install bridge-utils libvirt-clients libvirt-daemon-system virtinst polkitd
apt install ovmf netcat-openbsd
More information can be found here.
dnf install libvirt-devel virt-top libguestfs-tools virt-manager
More information can be found here.
- Start a VM:
virsh start [VM name]
- Stop a VM:
virsh shutdown [VM name]
- Rename VM:
virsh domrename [old name] [new name]
- Remove VM:
virsh undefine --remove-all-storage [VM name]
- Running VMs:
virsh list
- List all VMs:
virsh list --all
- Export VM def:
virsh dumpxml [VM name]
- VM image files:
/var/lib/libvirt/images
virt-clone -o [original] -n [new]--auto-clone
virt-sysprep --hostname [new hostname] -d [new]
Example:
virt-clone -o debian-server -n workstation --auto-clone
virt-sysprep --hostname workstation -d workstation
To resize a qcow2 image:
qemu-img resize [qcow2 file] +[size]
cp [qcow2 file] [qcow2 new file]
virt-resize –expand [partition] [qcow2 new file] [qcow2 file]
Example:
qemu-img resize undercloud.qcow2 +20G
cp undercloud.qcow2 undercloud-orig.qcow2
virt-resize –expand /dev/sda1 undercloud-orig.qcow2 undercloud.qcow2
- Open Up to Outside Connections
/etc/libvirt/qemu.conf
:
vnc_listen = 0.0.0.0
spice_listen = 0.0.0.0
- Audio
/etc/libvirtd/qemu.conf
:
vnc_allow_host_audio = 1
nographics_allow_host_audio = 1