参考:
https://www.bilibili.com/read/cv33557374/
1)首先先安装好wsl ubuntu系统
2)安装 Ubuntu 桌面版
sudo apt purge -y acpid acpi-support modemmanager
sudo apt-mark hold acpid acpi-support modemmanager
sudo apt install ubuntu-desktop
3)配置显示管理器
安装 Xfce4 桌面环境:
sudo apt install xfce4 xfce4-goodies
在 Ubuntu 终端中设置 DISPLAY 环境变量:
export DISPLAY=$(awk '/nameserver / {print$2; exit}' /etc/resolv.conf 2>/dev/null):0
使用sudo 启动 Xfce 会话:
sudo startxfce4
启动报错sudo startxfce4
/usr/bin/startxfce4: X server already running on display 127.0.0.42:0
xrdb: Connection refused
xrdb: Can’t open display ‘127.0.0.42:0’
xfce4-session: Cannot open display: .
Type ‘xfce4-session --help’ for usage.sudo startxfce4
/usr/bin/startxfce4: X server already running on display 127.0.0.42:0
xrdb: Connection refused
xrdb: Can’t open display ‘127.0.0.42:0’
xfce4-session: Cannot open display: .
Type ‘xfce4-session --help’ for usage.
修改:
如果输出为空或不正确,你可以手动设置 DISPLAY 变量:
export DISPLAY=:0
4)修改后重新启动
桌面可以看到,但是背景是透明的