Create and register QEMU virtual machine via bash.
To create and set up a virtual machine (VM) using QEMU and then register it with Virt-Manager, you've followed a good path. Below is a concise overview of the steps involved:
Create the VM XML Configuration File: You've created an XML file named
win11.03.xml, which defines the VM properties. Make sure this XML file includes the necessary details such as memory, CPU, disk, and network interface settings.If you need the XML template again, it would look something like this:
<domain type='kvm'> <name>Windows11</name> <memory unit='MiB'>4096</memory> <vcpu placement='static'>4</vcpu> <os> <type arch='x86_64' machine='pc-q35-6.2'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <vmport state='off'/> </features> <cpu mode='host-passthrough'> <topology sockets='1' cores='4' threads='1'/> </cpu> <clock offset='localtime'> <timer name='rtc' tickpolicy='catchup'/> <timer name='pit' tickpolicy='delay'/> <timer name='hpet' present='no'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/media/backup_005_3/qemu/win.11.03.qcow2'/> <target dev='vda' bus='virtio'/> </disk> <controller type='usb' model='qemu-xhci' ports='15'/> <interface type='network'> <mac address='52:54:00:ab:cd:ef'/> <source network='default'/> <model type='virtio'/> </interface> <input type='tablet' bus='usb'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='qxl' ram='65536' vram='65536' vgamem='16384'/> </video> <memballoon model='virtio'/> </devices> </domain>Place the XML File: Move your
win11.03.xmlfile to the standard directory for libvirt configurations:sudo cp win11.03.xml /etc/libvirt/qemu/Define the Virtual Machine: Use the following command to define the VM configuration:
sudo virsh define /etc/libvirt/qemu/win11.03.xmlLaunch Virt-Manager: Open Virt-Manager, and you should see the newly defined "Windows11" VM in the list.
Start the Virtual Machine: You can right-click on the VM in Virt-Manager to start it or use the command line:
sudo virsh start Windows11
Make sure to replace paths and parameters as necessary for your specific setup. With these steps, you should be able to create, configure, and manage your Windows 11 VM effectively using Virt-Manager and QEMU.