随着 WSL (Windows Subsystem for Linux)的日趋完善,在 Windows 上运行 Linux 桌面环境已经成为可能。

以 Xfce 桌面环境为例,首先,打开 Bash on Ubuntu on Windows,安装 Xfce 4 软件包:

sudo apt install xfce4

由于 WSL 中并不能直接启用 X Server,因此我们需要安装 Windows 上的 X Server 软件,例如 VcXsrv

在 Windows 上启动 VcXsrv,一个 Windows 上的 X Server 就运行起来了。

接下来,需要在 Bash 中配置 $DISPLAY,以便 Linux 中的 X Client(即 Xfce 4)能够找到正确的 X Server。

export DISPLAY:0.0

可以将这行命令写入.bashrc,这样日后就不需要每次都重新设置了:

echo "export DISPLAY=:0.0">> ~/.bashrc

最后,启动 Xfce:

startxfce4

现在,你应该可以在 Windows 运行 Xfce 桌面环境了!

p.s. 如果中文显示出现问题,可以通过apt安装中文字体解决:

sudo apt install fonts-wqy-microhei