wsl2 内核滚动版安装指南
内核镜像
手动安装
- 从 Releases 页面下载内核镜像。
- 将其放置在合适的位置。(例如:
D:\WSL2\Kernel\bzImage-x86_64) 在当前用户的家目录(主目录)中保存
.wslconfig文件,内容如下:[wsl2] kernel=the\\path\\to\\bzImage ; e.g. ; kernel=D:\\WSL2\\Kernel\\bzImage-x86_64 ; ; Note that all `\` should be escaped with `\\`.- 重启你的 WSL2(
wsl --shutdown),并在 WSL2 终端中使用uname -a检查内核版本。
通过 Scoop 安装
Scoop 是 Windows 上的命令行包管理器。如果你已安装 Scoop,可以使用以下命令安装此内核:
scoop bucket add frostbite https://github.com/Nevuly/frostbite # Install normal kernel version scoop install frostbite/wsl2-rolling-kernel-stable # Install Real-Time kernel version scoop install frostbite/wsl2-rolling-kernel-stable-rt- Scoop 会自动在
.wslconfig中配置内核路径。
更新内核镜像
- 如果你是通过 Scoop 安装的,可以在 PowerShell 中运行
scoop update *。 - 如果你是手动安装的,请从 Releases 页面下载新文件并直接替换。
内核附加包
手动安装
- 从 Releases 页面下载内核附加包。
- 解压并放置在合适的位置。(例如:
D:\WSL2\Kernel\bzImage-x86_64-addon.vhdx) 在当前用户的家目录中保存
.wslconfig文件,内容如下:[wsl2] kernelModules=the\\path\\to\\bzImage-addon.vhdx ; e.g. ; kernelModules=D:\\WSL2\\Kernel\\bzImage-x86_64-addon.vhdx ; ; Note that all `\` should be escaped with `\\`.- 重启你的 WSL2(
wsl --shutdown),并检查 Linux 内中的/lib/modules目录。
通过 Scoop 安装
如果你已安装 Scoop,可以使用以下命令安装内核附加包:
scoop bucket add frostbite https://github.com/Nevuly/frostbite # Install normal kernel version addon scoop install frostbite/wsl2-rolling-kernel-stable-addon # Install Real-Time kernel version addon scoop install frostbite/wsl2-rolling-kernel-stable-rt-addon- Scoop 会自动在
.wslconfig中配置该项。
更新内核附加包
- 如果你是通过 Scoop 安装的,可以在 PowerShell 中运行
scoop update *。 - 如果你是手动安装的,请从 Releases 页面下载新包,解压后直接替换旧文件。
使用
ZFS模块
ZFS 模块位于以下路径,默认处于禁用状态:
/lib/modules/$(kernel_version)-WSL2-STABLE+/extra要使用它,可以输入以下命令进行启用:
# Update kernel module dependencies for load ZFS kernel module correctly.
sudo depmod -a
# Probe ZFS SPL driver
sudo modprobe spl
# Probe ZFS driver
sudo modprobe zfs在你的 Linux 发行版中安装好所需的 ZFS 软件包后,上述操作即可生效。
原文链接:WSL2 Linux Kernel Rolling Wiki - Install Instructions
项目地址:Nevuly/WSL2-Linux-Kernel-Rolling
译者说明:本文为官方安装指南的AI中文翻译版本,方便国内开发者参考与转载。