After we create the Windows image, We can create a new empty VM that we can call ”win11”
lxc init win11 --vm --empty
The default storage/disk provided to new VMs is 10GB, which is not enough for Windows so we need to increase the size of the disk to 50GB with the following command before proceeding
lxc config device override win11 root size=50GiB
We should also increase the CPU limits for optimal performance
lxc config set win11 limits.cpu=4 limits.memory=8GiB
Next, we need to add TPM (Trusted Platform Module) as it’s one of the things Windows requires. We can call it vtpm as it is a virtual TPM after all. Adding TPM will also enable you to enable things like bitlocker inside of your VM.
lxc config device add win11 vtpm tpm path=/dev/tpm0
The last thing we need to do is add the install media Itself and make it a boot priority (so it boots automatically).
lxc config device add win11 install disk source=/home/mionaalex/Downloads/win11.lxd.iso boot.priority=10
If you are doing this in a cluster, make sure to launch this commands on the same member where the targeted instance is placed. You can check this with lxc info win11
ⓘReplace /home/mionaalex/Downloads/ with your own path to the repackaged file
Now we can start the installer.
ⓘYou will need to manually provide a VGA console access by installing either remote-viewer or spicy. If neither of these is found in the system, you will get a message instructing you to install them.
lxc start win11 --console=vga
If needed, install a Spice client as prompted:
sudo apt-get install -y --no-install-recommends virt-viewer
Or
sudo apt-get install -y --no-install-recommends spice-client-gtk
The rest of the installation will proceed automatically.