WSL与gnome-desktop

WSL与gome-desktop

经过测试和检索
确定WSL1无法在gome-desktop实现GUI桌面
只能实现其中应用的现实,比如打开记事本在Xserver
https://www.reddit.com/r/bashonubuntuonwindows/comments/51f7ni/how_to_run_gnome_terminal_on_wsl/
xface和mate可以安装。gnome似乎因为一些底层调用无法兼容。
https://askubuntu.com/questions/1162808/run-ubuntu-desktop-on-wsl-ubuntu-18-04-lts

WSL2与gnome-desktop

初始化

sudo apt update
sudo apt upgrade
sudo apt install ubuntu-desktop gnome

设置Xserver

nano ~/.bashrc
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export LIBGL_ALWAYS_INDIRECT=1

重启WSL

windows命令行

wsl --shutdown

启动会话

gnome-session

启动Xserver

发现没有现实

修改相关设置

wsl2: export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
x-server: disable access control and -ac
firwall: VcXsrv windows xserver allow

reference

https://gist.github.com/Ta180m/e1471413f62e3ed94e72001d42e77e22里面方法已经过期,不要使用其中脚本
https://github.com/microsoft/WSL/issues/4106

posted @ 2021-04-06 15:06  fengmao31  阅读(713)  评论(0编辑  收藏  举报