快速开始(对齐官方 Getting Started)
前置条件
- Node.js 22+
- 一种可用模型 Provider(在
onboard向导里配置) - 建议先从本地
loopback模式跑通
参考:
最短可用路径(推荐)
1. 安装
bash
# macOS / Linux
curl -fsSL https://openclaw.ai/install.sh | bash
# Windows PowerShell
iwr -useb https://openclaw.ai/install.ps1 | iex
# npm / pnpm(已有 Node 环境)
npm install -g openclaw@latest
# 或
pnpm add -g openclaw2. 运行向导并安装网关服务
bash
# 交互式配置向导
openclaw onboard
# 安装为系统服务(推荐)
openclaw onboard --install-daemon3. 检查网关状态
bash
# 基础状态检查
openclaw gateway status
# 完整状态检查
openclaw status
# 深度诊断
openclaw gateway status --deep4. 打开控制台
bash
# 启动 Dashboard
openclaw dashboard
# 指定端口
openclaw dashboard --port 3001可选:前台调试启动
bash
# 前台启动(调试用)
openclaw gateway --port 18789 --verbose
# 查看日志
openclaw logs --follow
# 过滤日志
openclaw logs --filter error
openclaw logs --filter "channel:discord"首日验收清单
bash
# 1. 网关状态检查
openclaw gateway status
# 预期输出:running, healthy
# 2. 运行时状态检查
openclaw status
# 预期输出:runtime connected, channels available
# 3. 渠道状态检查
openclaw channels status --probe
# 预期输出:至少 1 个渠道 active
# 4. Dashboard 可访问
openclaw dashboard
# 预期:浏览器自动打开 http://localhost:3000
# 5. 发送测试消息
# 通过已配置的渠道发送一条消息,确认收到回复验收检查表
markdown
- [ ] `openclaw gateway status` 显示 running
- [ ] `openclaw status` 显示 runtime 和 channels 正常
- [ ] Dashboard 可访问
- [ ] 至少 1 个渠道或 WebChat 可以收发消息
- [ ] 能成功触发一次最小任务(如发送 "你好")
- [ ] 日志中无连续错误关键环境变量(运维常用)
bash
# 核心路径
export OPENCLAW_HOME="$HOME/.openclaw"
export OPENCLAW_STATE_DIR="$HOME/.openclaw/state"
export OPENCLAW_CONFIG_PATH="$HOME/.openclaw/config.yaml"
# 网关配置
export OPENCLAW_GATEWAY_PORT=18789
export OPENCLAW_GATEWAY_HOST=127.0.0.1
# 日志配置
export OPENCLAW_LOG_LEVEL=info
export OPENCLAW_LOG_FORMAT=json
# 安全配置
export OPENCLAW_GATEWAY_TOKEN=your-secure-token参考:
常见问题排查
问题 1:网关启动失败
bash
# 检查端口占用
lsof -i :18789
# 检查权限
ls -la ~/.openclaw
# 查看详细日志
openclaw gateway start --verbose问题 2:渠道配对失败
bash
# 检查渠道配置
openclaw channels list
# 重新配对
openclaw channels pair <channel-name> --force
# 查看渠道日志
openclaw logs --filter "channel:<channel-name>"问题 3:模型调用失败
bash
# 检查 Provider 配置
openclaw config get providers
# 测试模型连接
openclaw providers test
# 检查 API 密钥
openclaw secrets validate下一步
推荐学习路径
txt
Day 1: 安装 -> 验收 -> 发送第一条消息
Day 2: 配置渠道 -> 多渠道接入 -> 路由规则
Day 3: 工具配置 -> 权限策略 -> 安全加固
Day 4: Skills 开发 -> 自定义能力 -> 团队复用
Day 5: 监控告警 -> 故障排查 -> 日常运维