Skip to content

Instantly share code, notes, and snippets.

@nufeng1999
Last active June 21, 2021 05:24
Show Gist options
  • Select an option

  • Save nufeng1999/85617c6bfd3a895a97238d64a3318943 to your computer and use it in GitHub Desktop.

Select an option

Save nufeng1999/85617c6bfd3a895a97238d64a3318943 to your computer and use it in GitHub Desktop.
[轻松开启 WSL2 图形界面功能] #WSL #GUI #Cygwin #XWin

如何开启 WSL2 图形界面功能?

注意下面的操作仅在root用户下操作完成

wsl -u root -d Ubuntu

1.给WSL2安装必须的一些软件

apt install gedit fcitx fcitx-config-gtk fcitx-sunpinyin fcitx-pinyin fcitx-googlepinyin xfonts-intl-chinese

apt install xfonts-wqy xfonts-unifont fonts-wqy*

apt install language-pack-gnome-zh-hans language-pack-kde-zh-hans language-pack-zh-hans

2.创建一个目录

mkdir /opt/WSL

cd /opt/WSL

3.获取WSL2开启图形界面功能的软件并安装

git clone https://github.com/nufeng1999/wsl_XWin_Cygwin.git --recurse-submodules

cd wsl_XWin_Cygwin

chmod +x ./install.sh;./install.sh

4.关闭WSL2

DOS/PowerShell状态下执行

wsl --shutdown

5.重新进入WSL2

wsl -u root -d Ubuntu

执行GUI APP

gedit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment