Clawdbot Windows (WSL2) 設定

使用 WSL2 在 Windows 上執行 Clawdbot AI 助手。透過 Ubuntu 獲得完整的 Linux 體驗,確保一致的執行環境和工具相容性。

Clawdbot Windows 概覽

在 Windows 上建議透過 WSL2 使用 Clawdbot(建議使用 Ubuntu)。CLI + Gateway 在 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

Gateway 服務安裝(CLI)

在 WSL2 內:

# 選項 1
clawdbot onboard --install-daemon

# 選項 2
clawdbot gateway install

# 選項 3
clawdbot configure
# 提示時選擇「Gateway service」

修復/遷移:

clawdbot doctor

透過區域網路公開 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 以供區域網路存取;127.0.0.1 僅保持本機存取
  • 若要自動更新,請註冊排程工作在登入時執行

Gateway 設定

請參閱主要指南:

健康檢查

clawdbot status
clawdbot health
clawdbot doctor

Windows 配套應用程式

目前尚無 Windows 配套應用程式。歡迎貢獻。

後續步驟