type
status
date
slug
summary
tags
category
icon
password
最快的方法(Windows 11 / Windows 10 2004+)
- 确认版本
按
Win + R
→ 输入 winver
查看。需要 Windows 10 2004(Build 19041)及以上或 Windows 11。 - 用管理员权限打开 PowerShell,执行:
这条命令会打开所需功能并默认安装 Ubuntu。执行后重启,再按提示为 Linux 发行版创建用户名和密码。
想直接装指定发行版(比如 Ubuntu 22.04):
例如
wsl --install -d Ubuntu-22.04
- (可选)设置/查看 WSL 版本 新装默认就是 WSL2。若需要手动设置或查看:
- 更新 WSL 组件/内核(推荐)
并可用
wsl --status
查看当前 WSL 与内核信息。初始化后的常用操作
- 进入默认发行版 / 执行命令
直接在 PowerShell 输入
wsl
进入;或wsl <linux命令>
在当前窗口执行。
- 切换默认发行版
- 关闭并重启 WSL(遇到异常很常用) 然后重新打开发行版即可。
- 启用 systemd(需要较新 WSL)
在发行版里编辑
/etc/wsl.conf
: 回到 PowerShell 执行wsl --shutdown
再启动发行版。
PS:开启wsl功能需要在windows设置里开启相应功能

- Author:Gweek
- URL:https://www.myla.eu.org/article/wslanzhuang
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!