wsl为window子系统工具
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
(PowerShell)dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
(PowerShell)wsl --set-default-version 2
设置wsl默认版本,也就是新子系统安装时使用的wsl版本wsl -l -v
查看所有已安装子系统及其wsl版本wsl --set-version UbuntuXX 2
设置某个已安装子系统的wsl版本Add-AppxPackage .\app_name.appx
使用PowerShell安装该文件q1sudo su
切换到root用户(可选)sudo apt-get update
(apt更新)wsl --list
列出所有已安装系统wsl --unregsiter {system name}
卸载指定系统(system name即是上面命令返回的列表字符串)code .
q2cd /mnt/
export ALL_PROXY="http://127.0.0.1:10809"
wsl -l -v
wsl --export Ubuntu-20.04 d:\ubuntu20.04.tar
wsl --unregister Ubuntu-20.04
wsl --import Ubuntu-20.04 d:\ubuntu d:\ubuntu20.04.tar --version 2
del d:\ubuntu20.04.tar
sudo su
su - username
#!/bin/bash
host_ip=$(cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " ")
export ALL_PROXY="http://$host_ip:10809"
export HTTP_PROXY="http://$host_ip:10809"
export HTTPS_PROXY="https://$host_ip:10809"
export https_proxy="https://$host_ip:10809"
export http_proxy="http://$host_ip:10809"
export all_proxy="http://$host_ip:10809"
echo "proxy ip:$ALL_PROXY"
执行时需用source执行,否则无法生效
fsutil.exe file setCaseSensitiveInfo <path> enable
fsutil.exe file setCaseSensitiveInfo <path> disable
fsutil.exe file queryCaseSensitiveInfo <path>
The system can not find the file specified.
If you have downloaded the Appx file then extract it with any unzipping tool (for example 7zip) in a folder and run the ubuntu.exe in it.
在/etc/wsl.conf文件(没有则touch一个)里加入如下代码:
[interop]
enabled = true
appendWindowPath = true
ubuntu.exe config --default-user root
NoLsp.exe C:\windows\system32\wsl.exe
error: chmod on /aosp/.repo/repo/.git/config.lock failed: Operation not permitted
参考https://github.com/docker/for-win/issues/6284
参考https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/
执行bcdedit /set hypervisorlaunchtype auto
然后重启系统即可
声明:转载请注明出处,原文地址:shlu's note