pátek 21. října 2022

How to run X11 applications from WSL2

 Install Xming X server.

Open WSL and set up the DISPLAY variable:

export DISPLAY="`sed -n 's/nameserver //p' /etc/resolv.conf`:0"

try to run some X application, for example xclock

If an error will be shown, check the Xming log

You will find there:

client 4 rejected from IP XXX.XXX.XXX.XXX

Go to c:\Program Files (x86)\Xming\

Edit X0.hosts and add IP address from the error log above

Restart Xming