Windows (WSL2)
Windows (WSL2)
Section titled “Windows (WSL2)”OpenClaw 在 Windows 上推荐 通过 WSL2 运行(推荐 Ubuntu)。CLI + 网关在 Linux 内部运行,这保持了运行时的一致性,并使工具兼容性更好(Node/Bun/pnpm,Linux 二进制文件,技能)。原生 Windows 安装未经测试且问题较多。
计划推出原生 Windows 配套应用。
安装 (WSL2)
Section titled “安装 (WSL2)”- 入门 (在 WSL 内部使用)
- 安装与更新
- 官方 WSL2 指南 (Microsoft): https://learn.microsoft.com/windows/wsl/install
网关服务安装 (CLI)
Section titled “网关服务安装 (CLI)”在 WSL2 内部:
openclaw onboard --install-daemon或者:
openclaw gateway install或者:
openclaw configure在提示时选择 Gateway service。
修复/迁移:
openclaw doctor高级:通过 LAN 暴露 WSL 服务 (portproxy)
Section titled “高级:通过 LAN 暴露 WSL 服务 (portproxy)”WSL 有自己的虚拟网络。如果另一台机器需要访问运行在 WSL 内部 的服务(SSH,本地 TTS 服务器,或网关),您必须将 Windows 端口转发到当前的 WSL IP。WSL IP 在重启后会更改,因此您可能需要刷新转发规则。
示例(PowerShell 作为管理员):
$Distro = "Ubuntu-24.04"$ListenPort = 2222$TargetPort = 22
$WslIp = (wsl -d $Distro -- hostname -I).Trim().Split(" ")[0]if (-not $WslIp) { throw "WSL IP not found." }
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=$ListenPort ` connectaddress=$WslIp connectport=$TargetPort允许端口通过 Windows 防火墙(一次性):
New-NetFirewallRule -DisplayName "WSL SSH $ListenPort" -Direction Inbound ` -Protocol TCP -LocalPort $ListenPort -Action Allow在 WSL 重启后刷新 portproxy:
netsh interface portproxy delete v4tov4 listenport=$ListenPort listenaddress=0.0.0.0 | Out-Nullnetsh interface portproxy add v4tov4 listenport=$ListenPort listenaddress=0.0.0.0 ` connectaddress=$WslIp connectport=$TargetPort | Out-Null注意:
- 从另一台机器 SSH 的目标是 Windows 主机 IP(例如:
ssh user@windows-host -p 2222)。 - 远程节点必须指向一个 可达的 网关 URL(不是
127.0.0.1);使用openclaw status --all确认。 - 使用
listenaddress=0.0.0.0进行 LAN 访问;127.0.0.1仅保持本地访问。 - 如果您希望自动执行此操作,请注册一个计划任务在登录时运行刷新步骤。
一步步安装 WSL2
Section titled “一步步安装 WSL2”1) 安装 WSL2 + Ubuntu
Section titled “1) 安装 WSL2 + Ubuntu”打开 PowerShell(管理员):
wsl --install# 或者明确选择一个发行版:wsl --list --onlinewsl --install -d Ubuntu-24.04如果 Windows 要求,请重启。
2) 启用 systemd (网关安装必需)
Section titled “2) 启用 systemd (网关安装必需)”在您的 WSL 终端中:
sudo tee /etc/wsl.conf >/dev/null <<'EOF'[boot]systemd=trueEOF然后从 PowerShell:
wsl --shutdown重新打开 Ubuntu,然后验证:
systemctl --user status3) 安装 OpenClaw (在 WSL 内部)
Section titled “3) 安装 OpenClaw (在 WSL 内部)”在 WSL 内部遵循 Linux 入门流程:
git clone https://github.com/openclaw/openclaw.gitcd openclawpnpm installpnpm ui:build # 首次运行时自动安装 UI 依赖pnpm buildopenclaw onboard完整指南:入门
Windows 配套应用
Section titled “Windows 配套应用”我们还没有 Windows 配套应用。如果您想贡献力量使其实现,欢迎贡献。