X Window with WSL2
This was actually pretty straightforward:
- Install VcXsrv on Windows. (I used
cinst vcxsrv
.) - Install X apps on Linux. (My first use case was OWASP ZAP.)
- Set an environment variable on Linux that references the Windows host by its IP address.
The last step is arguably the hardest. It looks like this:
export DISPLAY=$(/sbin/ip route | awk '/default/ { print $3 }'):0
For more information about that, see WSL2 Networking.
Run VcXsrv, choose no startup program. You get the most seamless experience by choosing multiple windows. Now just run the X clients on Linux from a shell window, and they should display on your Windows desktop.