一路踩坑,僅做記錄
安裝
終端始終以管理員身份運(yùn)行
主板上開啟CPU虛擬化
啟用或關(guān)閉windows功能打開Haper-v 和 適用于Linux的window子系統(tǒng)
安裝wsl
wsl --install
打開Microsoft Store,搜索Ubuntu 或者WSL,選一個版本安裝即可
查看已安裝的子系統(tǒng)
wsl -l 或者 wsl --list --verbose
- 卸載一個子系統(tǒng)(會刪除數(shù)據(jù),謹(jǐn)慎操作)
wsl --unregister Ubuntu-22.04
開啟
應(yīng)用程序直接點(diǎn)擊Ubuntu關(guān)閉
wsl --shutdown
遷移到非系統(tǒng)盤
詳細(xì)查看這個文章
- 先導(dǎo)出
wsl --export Ubuntu-22.04 D:\Ubuntu\ubuntu.tar
- 卸載原來的(在C盤)
wsl --unregister Ubuntu-22.04
- 再導(dǎo)入
wsl --import Ubuntu-22.04 D:\Ubuntu\ D:\Ubuntu\ubuntu.tar --version 2
錯誤記錄&解決辦法
- Error code: Wsl/Service/0x800706f7
netsh winsock reset
- \Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx”附加 到 WSL2: 系統(tǒng)找不到指定的文件。
wsl --unregister ubuntu 然后重裝
- Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
- 主板開啟CPU虛擬
- 執(zhí)行以下命令
bcdedit /set hypervisorlaunchtype auto
- 無法加載文件 C:\Users\xxx\Documents\WindowsPowerShell\profile.ps1,因?yàn)樵诖讼到y(tǒng)上禁止運(yùn)行腳本
更換腳本執(zhí)行策略:set-ExecutionPolicy RemoteSigned,然后輸入 Y。
- 嘗試檢索虛擬交換機(jī)列表時出錯
以下取消勾選,重啟再勾選,再重啟就好了
image.png