[新服务] WSL - Windows Subsystem for Linux并在开机后自动打开
date
Mar 31, 2023
slug
newservice-wsl-windows11-linux
status
Published
summary
新服务-
tags
service
type
Post
URL
Summary步骤#开启功能+重启#安装Ubuntu - search in the microsoft store如果中间出现错误 - https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package开机登陆后自动开启验证
Summary
步骤
#开启功能+重启
#安装Ubuntu - search in the microsoft store
- or use winget search/install to install - same effect
如果中间出现错误 - https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
# Step 1 - Enable the Windows Subsystem for Linux
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# Step 3 - Enable Virtual Machine feature
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Set WSL 2 as your default version
wsl --set-default-version 2
# list all distros & find the one to remove
wsl --list
wsl --unregister <DistroName>
# now re-install using winget search/install or directly from microsoft store
# start a particular distro
wsl -d <DistroName>
开机登陆后自动开启
- Press Win + R, type shell:startup, and press Enter to open the Windows Startup folder.
- create a .bat file launch_wsl_distributions.bat
start cmd.exe /k wsl.exe -d Ubuntu-22.04
start cmd.exe /k wsl.exe -d AlmaLinux9
- 开机就自动了