网址:https://github.com/microsoft/wslg
https://learn.microsoft.com/zh-cn/windows/wsl/tutorials/gui-apps
下面是安装好以后,在Windows桌面使用虚拟机wsl内的软件,不需要其他的应用,也就是Windows桌面承载了wsl内的应用,可以直接使用
安装方式:
安装wsl
https://learn.microsoft.com/zh-cn/windows/wsl/install
wsl --install
切换到版本2
查看版本: wsl --list -v
切换到版本2: wsl --set-version _distro_name_ 2
默认使用版本2:wsl --set-default-version 2
重启wsl: wsl --shutdown
升级
切换到版本2以后,还需要做升级:wsl --update
升级完成以后,再次重启的:wsl --shutdown
最后,重启完成以后,就可以安装想在Windows桌面使用的wsl虚拟机桌面应用
## Update list of available packages
sudo apt update
## Gedit
sudo apt install gedit -y
## GIMP
sudo apt install gimp -y
## Nautilus
sudo apt install nautilus -y
## VLC
sudo apt install vlc -y
## X11 apps
sudo apt install x11-apps -y
## Google Chrome
cd /tmp
sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt install --fix-broken -y
sudo dpkg -i google-chrome-stable_current_amd64.deb
## Microsoft Teams
cd /tmp
sudo curl -L -o "./teams.deb" "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=linux&arch=x64&download=true&linuxArchiveType=deb"
sudo apt install ./teams.deb -y
## Microsoft Edge Dev Browser
sudo curl https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-dev/microsoft-edge-dev_118.0.2060.1-1_amd64.deb -o /tmp/edge.deb
sudo apt install /tmp/edge.deb -y
若是安装Google浏览器,或者安装edge浏览器的时候,出现不能下载的情况,那就是下载包被移除了,需要打开网页自己选择一个浏览器的安装包,网址就是去除安装包以后的网址https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-dev/
安装好以后就可以使用了
gnome-text-editor ~/.bashrc
gimp picture
nautilus file
vlc
xcalc、xclock、xeyes
google-chrome
microsoft-edge
使用visual studio code
使用visual studio code的话,不需要在wsl虚拟机中安装visual studio code,只需要在window中安装就可以了,然后再wsl中输入code就可以使用
zj@DESKTOP-PD3PB7D:~$ code
To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use thecode
command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] N
若是在wsl中安装了visual studio code,还需要卸载掉:sudo dpkg -r code,-r是remove