How can install windows on LXD

I have followed the Running virtual machines with LXD 4.0 and
YouTube video Windows 11 VM on LXD to install Windows in LXD, both failed.

The basic steps are:

root@test:~# lxc --version
5.4

finally, how to solve it. Could any one really help me?

The error message is:
Unable to init server: Could not connect: Connection refused
(remote-viewer:2432389): Gtk-WARNING **: 18:08:31.238: cannot open display:

or

root@test:/data# lxc start win2019 --console=vga

Unable to init server: Could not connect: Connection refused
(remote-viewer:2443885): Gtk-WARNING **: 19:37:13.132: cannot open display:

Try not to do it as root?

I start Windows with not root,and I got an error too

And running something like xeyes works from that shell?

Thanks stgraber, I solved it by executing on the local terminal of the physical machine. :grinning:

If you’re accessing the server via SSH try executing export XAUTHORITY=$HOME/.Xauthority before you open up a console. I had similar message due to X11 forwarding issues.

You can also
lxc console REMOTE:VMNAME --type=vga
from your desktop without having to go into the physical machine