On win10 WSL + vscode + xserver configuration graphical development environment linux

Enough of a dual system switch back and forth to try a little wsl configuration linux environment (personal habits knock code on linux), due to the demand for graphical, and get xserver. Not installed linux graphical interface.

WSL

Installation pressing official documents to

Note wsl2 need Insider Previe version, the updated version of personal time because of anti-virus software at the time of restart of the green screen will report "PAGE_FAULT_IN_NONPAGED_AREA", error code 0xc1900101, learn a lesson.


linux distributions chose Ubuntu 18.04LTS, MIcrosoft Store there are other distributions to choose from. There can be no release of self-torment (such as Arch ).

You can install Windows Terminal at Microsoft Store, you can quickly open the terminal wsl.

Xserver

Personal use is VcXsrv .

WSL disposed in the environment variable DISPLAY, was added in the configuration in ~ / .bashrc.

WSL1 as:

export DISPLAY=localhost:0

WSL2 as:

export DISPLAY=`cat /etc/resolv.conf | grep nameserver | awk '{print $2}'`:0

(Reference herein https://zhuanlan.zhihu.com/p/51270874 )

Then open Xlaunch, pay attention to check the Disable Access Control , otherwise it will be reported, the other is the default option.

Authorization required, but no authorization protocol specified
Error: Can't open display

(Reference herein https://codeyarns.com/2019/05/11/vcxsrv-x-server-for-windows/ )

You can xeyes test.

VSCode

Mounted on a win vscode, marked with Remote-WSL plug-ins, you can use wsl environment through vscode direct, very convenient.

vscode can manage wsl of plug-ins that will win local and distinguished.

 

Guess you like

Origin www.cnblogs.com/Bcai0797/p/11511695.html