Setup

安装与首次运行

8分钟

安装 OpenClaw,完成 onboarding,验证 Gateway,并通过 Control UI 或聊天渠道发送第一条消息。

需要准备什么

  • Node.js 24 推荐,或 Node.js 22.19+
  • 一个模型提供商凭证,例如 Anthropic、OpenAI、Google、OpenRouter 等
  • 可选:Telegram、WhatsApp、Slack、Discord、Signal 或 iMessage 账号
  • 可选:Docker,用于沙盒化工具执行

检查本地运行时:

bash
node --version
npm --version

安装 OpenClaw

当前最快路径是安装脚本:

bash
curl -fsSL https://openclaw.ai/install.sh | bash

Windows 用户可以用 PowerShell:

powershell
iwr -useb https://openclaw.ai/install.ps1 | iex

如果你想用包管理器控制版本,也可以用 npm 或 pnpm:

bash
npm install -g openclaw@latest
pnpm add -g openclaw@latest

Windows 桌面用户也可以从 Windows Hub 开始,它提供 setup、托盘状态、聊天、node mode 和本地 MCP mode。

运行 Onboarding

bash
openclaw onboard --install-daemon

Onboarding 会引导你完成:

  • 模型提供商和凭证配置
  • Gateway token/auth 配置
  • workspace 初始化
  • 可选的聊天渠道配置
  • launchd 或 systemd 服务安装

验证 Gateway:

bash
openclaw gateway status

打开 Control UI

bash
openclaw dashboard

Control UI 是由 Gateway 提供的浏览器控制台。它可以聊天、查看会话、显示渠道状态、流式展示工具活动、管理节点和调整部分运行时设置。

本地 loopback 通常会自动批准。远程浏览器访问可能需要设备配对:

bash
openclaw devices list
openclaw devices approve <requestId>

发送第一条消息

先用 Control UI 聊天。这样可以证明 Gateway、模型凭证、会话存储和基础运行时已经工作。

也可以从 CLI 发起一次 Agent 轮次:

bash
openclaw agent --agent main --message "Create a short personal assistant smoke test checklist"

配置聊天渠道后,也可以发送渠道消息:

bash
openclaw message send --target +15555550123 --message "Hello from OpenClaw"

连接一个渠道

Telegram 通常最快,因为只需要 bot token。WhatsApp 需要 QR 配对并保存更多本地状态。Slack、Discord、Signal、iMessage、Matrix、Microsoft Teams、Google Chat、Zalo、SMS 等都有自己的约束。

bash
openclaw channels status
openclaw channels add
openclaw channels login --channel telegram

第一次安全检查

在让别人给你的 Agent 发消息前,先检查:

bash
openclaw doctor
openclaw security audit
openclaw status --usage

公共聊天平台保持 DM pairing。把每条入站聊天消息都当作不可信输入,尤其是群聊。

Upgrade Later

OpenClaw 发布频繁。根据安装方式,使用 updater 或 package manager 升级:

bash
openclaw update
openclaw doctor

Setup 也是架构验证

首次运行成功意味着四件事成立:Gateway 能接收认证客户端,模型凭证能调用,会话存储能持久化,至少一个界面能收发消息。

继续实践

安装与首次运行 的核心概念已经读完

如果你想把理解变成可复用的能力,可以到 AgentWay 继续练习