首先在 “控制面板”–“程序”–“启用或关闭Windows功能” 里开启 “适用于 Linux 的 Windows 子系统”
然后在应用商店安装任意一个发行版(ubuntu20.04)
等待安装完,更换源:
| sudo vim /etc/apt/source.list |
| deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse |
| deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse |
| |
| deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse |
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse |
| |
| deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse |
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse |
| |
| deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse |
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse |
| |
| deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse |
| deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse |
然后更改一下显示输出
| echo "export DISPLAY=127.0.0.1:0.0" >> ~/.bashrc |
| source ~/.bashrc |
如果有用root的话也弄一下
添加中文支持:
| sudo su |
| apt-get install language-pack-zh-hans |
| locale-gen zh_CN.UTF-8 |
| echo "export LC_ALL=zh_CN.UTF-8">> /etc/profile |
| source /etc/profile |
第一次source报错正常,重启一下就好了
图形应用支持:
| sudo apt-get install x11-apps |
然后应用商店装X410,打开
最后终端命令打开gui程序即可
参考:
https://blog.csdn.net/llllllloooooo/article/details/102852027
https://zhuanlan.zhihu.com/p/39446214
https://virtualizationreview.com/articles/2018/01/30/hands-on-with-wsl-graphical-apps.aspx