This entire article is a summation of https://manuelcortez.net/2023/12/creating-vm-windows11-libvirt/ which you should read for instructions on installing a Windows 11 virtual under libvirt. This summary is simply a set of instructions, a summary of that article.
Install tpm software module
apt install ovmf swptm swtpm-tools # fix a permissions issue on Debian 12 chown -R tss /var/lib/swtpm-localca
Create the installer command (modify for your configuration)
virt-install \ --name windows11-vm \ --cdrom /var/lib/libvirt/iso/win11-22h2.iso \ --os-variant=win11 \ --network network=bridged-network,model=virtio \ --disk size=50,cache=none,bus=virtio \ --disk path=/var/lib/libvirt/iso/virtio-win.iso,device=cdrom \ --memory 4096 \ --sound default \ --graphics spice,listen=0.0.0.0 \ --vcpu 4 --video qxl \ --noautoconsole \ --features kvm_hidden=on,smm=on \ --tpm backend.type=emulator,backend.version=2.0,model=tpm-tis \ --boot loader=/usr/share/OVMF/OVMF_CODE.secboot.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/OVMF/OVMF_VARS.ms.fd
Run the above command. It may stop, in which case, you need to edit the config file
virsh edit domainname
During installation