Since WSL2 doesn’t natively support GUI apps, you need an X server to render the GUI on Windows.
Install VcXsrv:
-
Download and install VcXsrv from here.
-
After installation, launch VcXsrv and configure the settings:
- Select Multiple windows for the display.
- Select Start no client.
- Enable Disable access control to allow WSL2 to communicate with the X server without restrictions.
Click Finish to start the X server.

To make the XLauncher start automatically, copy the saved config file to 'C:\Users\ZhangZhihui\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'.
Set Up the DISPLAY Environment Variable in Ubuntu (WSL2)
-
Open the
.bashrcor.zshrcfile in Ubuntu to set theDISPLAYvariable: -
Add this line at the end of the file:
-
Save and exit (
CTRL + X, thenYto confirm, andEnter). -
Reload the
.bashrcfile to apply the changes:


浙公网安备 33010602011771号