# Windows 上安裝 WSL(Windows Subsystem for Linux)適用於 Linux 的 Windows 子系統
> 適用於 Linux 的 Windows 子系統(WSL),可讓開發人員執行 GNU/Linux 環境 (包括大部分的命令列工具、公用程式和應用程式),直接在 Windows 上執行,不需進行修改,不會造成傳統虛擬機器或 dualboot 設定的額外負荷。
**Step 1 - Enable the Windows Subsystem for Linux**
準備好windows系統給Linux執行~

記得使用系統管理員身分執行~
PowerShell中輸入這些:
中輸入這些:
`dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart`
中輸入這些:會跳出成功執行訊息

**Step 2 - Update to WSL 2**
更新到WSL 2
一些必需條件:
* For x64 systems: Version 1903 or higher, with Build 18362 or higher.
* For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
* Builds lower than 18362 do not support WSL 2. Use the Windows Update Assistant to update your version of Windows.
如果你需要確認你電腦版本的話可以使用 WINDOWS符號+R 然後輸入winver
會出現這個視窗
(像我的版本就剛好適合)

**Step 3 - Enable Virtual Machine feature**
啟用Virtual Machine feature
一樣再次打開Powershell加上用系統管理員身分開始,
輸入
`dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart`
下圖顯示成功

接下來要重新啟動電腦讓他更新到WSL 2
**Step 4 - Download the Linux kernel update package**
下載Linux kernel update package
下載網址:
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.
**Step 5 - Set WSL 2 as your default version**
把WSL2 =設成預設
一樣打開powershell系統管理員模式下輸入:
`wsl --set-default-version 2`
**Step 6 - Install your Linux distribution of choice**
安裝Linux distribution
https://www.microsoft.com/zh-tw/p/ubuntu-2004-lts/9n6svws3rx71?rtc=1&activetab=pivot:regionofsystemrequirementstab

如果忘記密碼想要重設的話看這邊:
https://docs.microsoft.com/en-us/windows/wsl/user-support
----
**Update and upgrade packages**
更新一下剛剛裝好的packages
在剛剛的視窗中輸入以下:
```
sudo apt update && sudo apt upgrade
```
會需要安裝一陣子,等他更新完成就好摟!
----