发新话题
打印

Windows WSL升级到WSL2

Windows WSL升级到WSL2

https://docs.microsoft.com/en-us/windows/wsl/install-win10#update-to-wsl-2

查看winver版本,安装KB4566116升级Windows
https://www.catalog.update.microsoft.com/Search.aspx?q=KB4566116

重启后,以管理员身份运行:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

再重启,再
wsl --set-version Ubuntu 2
正在进行转换,这可能需要几分钟时间...

wsl --set-default-version 2
如果提示出错,则表明没有升级到位

查看当前版本:
wsl -l -v

ipconfig/all
以太网适配器 vEthernet (WSL):
   描述. . . . . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter
   IPv4 地址 . . . . . . . . . . . . : 192.168.190.1(首选)

WSL Linux的IP是192.168.190.6 等

缺省是NAT模式,如果需要改成桥接模式,请参考:
https://github.com/microsoft/WSL/issues/4150

修改/etc/resolv.conf:
# cat resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 192.168.190.1


WSL中打开当前目录的文件管理器界面:
# find the home folder
cd ~

# open up windows explorer for this folder
explorer.exe .
网络路径是: \\wsl$\Ubuntu\root


关闭WSL进程:
wsl --shutdown


升级为WSL2后,VMWARE Player/Workstation VirtualBox不能运行,需要关闭Device/Credential Guard。如果已关闭,需要打开才能运行WSL2,参考:
VMware Workstation 与 Device/Credential Guard 不兼容?
http://trustcomputing.com.cn/bbs/viewthread.php?tid=1683&extra=page%3D1


参考:
https://devblogs.microsoft.com/commandline/wsl-2-support-is-coming-to-windows-10-versions-1903-and-1909/#how-do-i-get-it
https://www.yht7.com/news/13051
https://scotch.io/bar-talk/trying-the-new-wsl-2-its-fast-windows-subsystem-for-linux

[ 本帖最后由 linda 于 2020-9-2 11:08 编辑 ]

TOP

发新话题