文章目錄
- Win 10使用WSL2
-
- 1. 啟用相關服務
- 2. 安裝Ubuntu和Windows terminal
- 3.在VS Code中配置Remote WSL
Win 10使用WSL2
WSL(windows subset for linux)
1. 啟用相關服務
PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19041.985
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
PS C:\WINDOWS\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19041.985
Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
2. 安裝Ubuntu和Windows terminal
重新開機之後
PS C:\WINDOWS\system32> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
然後去微軟Store下載下傳合适版本的Linux版本,如Ubuntu 20.04 LTS。
然後,啟動Ubuntu
Installing, this may take a few minutes...
等待的時間可以安裝一下Windows terminal,仍然是在Microsoft store中。
然後,很快兩者都配置完畢。
***@***-Desktop:/mnt/c/Users/***$ cat /etc/issue
Ubuntu 20.04.2 LTS \n \l
3.在VS Code中配置Remote WSL
隻要有VS Code,就很好做這一步。無需過多操作,基本一鍵配置。
