Before installing vcxsrv-64.1.20.9.0.installer.exe,
After starting the x-launch server
Cannot open display window via bash
error:
Unable to init server: Could not connect: Connection refused
(gedit:2705): Gtk-WARNING **: 17:54:46.065: cannot open display: :0.0
The reason may be that after WSl2.0 is changed, it is unable to connect to the server
Need to change ~/.bashrc file
sudo vim ~/.bashrc
#输入下面一行,下面为windows系统IP地址
export DISPLAY=192.168.0.103:0
#退出后 输入bash命令 生效
source ~/.bashrc
Then open the x launch server side
Pay attention to cancel access control! ! !
Click next, then finish.
Try to open again, such as gedit ~/.bashrc
Successfully opened the window!