2020年5月22日 星期五

[WSL2] Install and get started


 Windows 10   WSL2  


Steps






WSL2’s requirement is that we must upgrade Windows 10 to version 2004, Build 19041 or higher version. We have to join Windows Inside Program so that we can install the preview update from Windows Update.

Windows 10安裝WSL2的必要條件是必須把Windows 10升級到version 2004, Build 19041,或更高的版本。
要讓Windows抓到這些升級包必須加入到 Windows Inside Program (Windows 測試人員計畫)
方式進入到Windows Insider網站後,登入微軟帳號*,點選BECOME AN INSIDER加入計畫。





備註:如果你有使用公司網域帳號的話,而且公司網域帳號是有加入Office 365或整合Azure AD的話,請特別注意底下這個超級大雷!

因為我是從Microsoft Store自行購買Windows 10 Pro license,而此license是綁我自己的微軟帳號(非網域帳號),但是我用了公司的網域帳號加入Windows Insider Program後升級Windows 10,結果升級完後直接被強制升級到Windows 10 Enterprise!!
可是我沒有Windows 10 Enterprise的產品序號阿!! 在未正確授權情況下,除了個人化的選項無法使用,作業系統還會三不五時跳出來需要啟用Windows 10 Enterprise的訊息!! 最慘的是因為我的Windows 10 Pro是綁帳號授權(數位授權,沒有產品序號),而Windows 10 Enterprise要降級成 Pro需要輸入產品序號,所以就卡在被強制升級至Windows 10 Enterprise但是沒有啟用的狀態,真是無敵傻眼! 致電微軟客服,結果電話語音要我先輸入產品序號(FUXXX 我就是要跟你拿產品序號阿)

搞了半天,只好重新還原回上一個Windows 10版本 (此時恢復成Windows 10 Pro),然後用自己的微軟帳號加入Windows Insider Program後再重新升級Windows 10,這次終於成功升級而且保持Windows 10 Pro 前後花了我一天的時間,真是&*$#()#@$

After joining Windows Insider Program, got to SettingsWindows Insider Programand add the Microsoft account, and we can start running Windows Update.
加入Windows Insider ProblemProgram後,至SettingsWindows Insider Program把帳號塞進去,然後就可以開始跑Windows Update





Confirm the Windows 10 is updated to build 19041.264.
升級後確認一下目前的Windows 10 build版本是 19041.264




Since I had already installed Docker Desktop, the following message was pop-up after updated.
因為我原本有裝Docker Desktop,這時候就會看到底下這個訊息:





Enable the "Windows Subsystem for Linux" and "Virtual Machine Platform" optional features in Powershell on the above pop-up message or use the following ps commands:

上面的圖顯示需要啟用"Windows Subsystem for Linux""Virtual Machine Platform"功能,複製該行指令在Powershell執行;或使用以下兩行ps指令:

$ dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
$ dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart




Windows 10 notify that the WSL 2 Linux kernel must be installed after reboot.
重新開機後作業系統再次提示需要安裝 WSL 2 Linux kernel





Then use the following command to set the default WSL version:
完成後設定預設的WSL版本:

$ wsl --set-default-version 2




Now we can download and install Linux distribution on Microsoft Store, like Ubuntu 18.04 LTS:
接著我們可以到Microsoft Store下載 Linux發行版本(例如 Ubuntu 18.04 LTS):




After installing Ubuntu, click it to complete the setup.
安裝完成後,點選它以完成設定。




To see the distros on WSL2:
透過以下指令可以看到目前WSL2上的distros


$ wsl -l -v




You can set the default WSL version to the distro like this:
你可以透過以下指令更新該distroWSL版本:

$ wsl --set-version Ubuntu-18.04 2



Reference








沒有留言:

張貼留言