Clawdbot Windows (WSL2) 设置

使用 WSL2 在 Windows 上运行 Clawdbot AI 助手。使用 Ubuntu 获得完整的 Linux 体验,保持运行时和工具的一致性。

Clawdbot Windows 概述

推荐通过 WSL2 在 Windows 上运行 Clawdbot(推荐 Ubuntu)。CLI + 网关在 Linux 内运行,保持运行时一致性,使工具更加兼容。

原生 Windows 可能更棘手。WSL2 为您提供完整的 Linux 体验 — 一条命令安装:wsl --install

原生 Windows 配套应用正在计划中。

安装(WSL2)

步骤 1:安装 WSL2 + Ubuntu

打开 PowerShell(管理员):

wsl --install
# 或明确选择发行版:
wsl --list --online
wsl --install -d Ubuntu-24.04

如果 Windows 要求,请重启。

步骤 2:启用 systemd(必需)

在 WSL 终端中:

sudo tee /etc/wsl.conf > /dev/null << 'EOF'
[boot]
systemd=true
EOF

然后从 PowerShell:

wsl --shutdown

重新打开 Ubuntu,然后验证:

systemctl --user status

步骤 3:安装 Clawdbot(在 WSL 内)

在 WSL 内按照 Linux 入门流程:

# 选项 1:快速安装
curl -fsSL https://clawd.bot/install.sh | bash

# 选项 2:从源码
git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
pnpm install
pnpm ui:build
pnpm build
clawdbot onboard --install-daemon

网关服务安装(CLI)

在 WSL2 内:

# 选项 1
clawdbot onboard --install-daemon

# 选项 2
clawdbot gateway install

# 选项 3
clawdbot configure
# 提示时选择"网关服务"

修复/迁移:

clawdbot doctor

通过 LAN 暴露 WSL 服务(高级)

WSL 有自己的虚拟网络。如果另一台机器需要访问 WSL 内运行的服务,您必须将 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

允许通过防火墙(一次性)

New-NetFirewallRule -DisplayName "WSL SSH $ListenPort" -Direction Inbound `
    -Protocol TCP -LocalPort $ListenPort -Action Allow

WSL 重启后刷新

netsh interface portproxy delete v4tov4 listenport=$ListenPort listenaddress=0.0.0.0 | Out-Null
netsh 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
  • 使用 listenaddress=0.0.0.0 进行 LAN 访问;127.0.0.1 仅保持本地
  • 要自动刷新,注册一个在登录时运行的计划任务

网关配置

参见主要指南:

健康检查

clawdbot status
clawdbot health
clawdbot doctor

Windows 配套应用

我们还没有 Windows 配套应用。欢迎贡献。

下一步