====== 在 Win10 啟動 Linux(WSL) ======
* 安裝環境 \\ {{:tech:2020072601.png?400}}
===== 安裝程序 =====
- 使用系統管理者權限啟動 PowerShell , 執行 dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
{{:tech:2020072602.png}}
- 重新開機以完成 WSL 安裝
- 透過 winver 確認目前 win10 版本是 2004 版,組建 19041 或更高版本 \\ {{:tech:2020072603.png?400}}
- 使用系統管理者權限啟動 PowerShell , 執行 dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
{{:tech:2020072604.png}}
- 重新啟動以完成更新至 WSL 2。
- 將 WSL 2 設定為預設版本, 使用系統管理者權限啟動 PowerShell , 執行 wsl --set-default-version 2
萬一出現以下畫面, 就依照訊息顯示的連結網址 (https://aka.ms/wsl2kernel) 進行處理 \\ {{:tech:2020072605.png}}
- 下載最新的 WSL2 Linux 核心更新套件 [[https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi|wsl_update_x64.msi]] \\ {{:tech:2020072606.png?400}}
- 再次執行將 WSL 2 設定為預設版本 \\ {{:tech:2020072607.png}}
- 開啟 Microsoft Store,然後選取您最愛的 Linux 發行版本 \\ {{:tech:2020072608.png?600|}}
- 安裝與執行 Ubuntu \\ {{:tech:2020072609.png}} \\ {{:tech:2020072610.png}} \\ {{:tech:2020072611.png}} \\ {{:tech:2020072612.png}} \\ {{:tech:2020072613.png}}
- 安裝與執行 Debian \\ {{:tech:2020072614.png|}} \\ {{:tech:2020072615.png|}} \\ {{:tech:2020072616.png|}}
===== 更新 WSL 版本 =====
* 以 administrator 身分開啟 powser shell
* 查看目前 wsl 版本 wsl --version
* 更新 wsl 版本 wsl --update
* 參考實際更新畫面 \\ {{:tech:2024-01-12_122926.png|}}
===== 參考網址 =====
* https://docs.microsoft.com/zh-tw/windows/wsl/install-win10
{{tag>winlinux wsl}}