首页 教程 分类 Skills下载 关于
ZH EN JA KO
安装部署

openclaw setup 命令详解

· 5 分钟

命令概述

openclaw setup 是 OpenClaw 的一站式安装命令,它会自动完成环境检测、依赖安装、初始配置和服务启动等所有步骤。

基本用法

openclaw setup

这会启动交互式安装向导,引导你完成所有配置。

安装流程

执行 openclaw setup 后,会按顺序执行以下步骤:

1. 环境检测

Checking environment...
  ✓ Node.js v20.11.0
  ✓ npm v10.2.4
  ✓ Git v2.43.0
  ✓ Operating System: Linux x64
  ✓ Available memory: 4GB
  ✓ Available disk: 50GB

2. 选择安装模式

Select installation mode:
  [1] Quick Setup (recommended)
  [2] Custom Setup
  [3] Headless Setup (non-interactive)

3. 配置模型供应商

Select your primary model provider:
  [1] OpenAI
  [2] Anthropic
  [3] Ollama (local)
  [4] Other / Custom

4. 配置频道

Select channels to enable:
  [x] Telegram
  [ ] Discord
  [ ] WhatsApp
  [ ] Slack
  [ ] Web Chat

5. 安全设置

Configure security:
  Set Gateway API Key? [Y/n]
  Enable rate limiting? [Y/n]

命令行选项

非交互模式

openclaw setup --non-interactive \
  --provider openai \
  --api-key "sk-your-key" \
  --channel telegram \
  --telegram-token "123456:ABC"

指定配置文件

openclaw setup --config /path/to/config.json

从模板安装

openclaw setup --template minimal
openclaw setup --template full
openclaw setup --template developer

可用模板:

  • minimal:最小配置,仅核心功能
  • full:完整配置,所有功能
  • developer:面向开发者,包含调试工具

指定安装目录

openclaw setup --dir /opt/openclaw

跳过特定步骤

openclaw setup --skip-deps       # 跳过依赖检查
openclaw setup --skip-channel    # 跳过频道配置
openclaw setup --skip-start      # 安装后不自动启动

Docker 安装

使用 Docker 模式安装:

openclaw setup --docker

这会自动生成 Docker Compose 文件和环境变量文件:

Generated files:
  docker-compose.yml
  .env
  config/config.json

导入已有配置

从已有安装迁移:

openclaw setup --import /path/to/old/config.json

从环境变量导入:

openclaw setup --import-env

安装后验证

安装完成后自动运行诊断:

Running post-installation checks...
  ✓ Configuration valid
  ✓ Provider connected
  ✓ Channel configured
  ✓ Gateway started on port 3000

Setup complete! Your OpenClaw instance is ready.
Dashboard: http://localhost:3000

重新运行 Setup

如果需要重新配置:

# 保留现有配置,只添加新组件
openclaw setup --add

# 完全重新配置
openclaw setup --reset

注意:--reset 会清除现有配置,请先备份:

openclaw configure --export backup.json

常见问题

Q: setup 中途失败怎么办? 重新运行 openclaw setup,它会检测已完成的步骤并跳过。

Q: 可以后续添加频道吗? 可以,使用 openclaw channels add 或重新运行 openclaw setup --add

Q: 如何查看 setup 日志?

cat ~/.openclaw/logs/setup.log

总结

openclaw setup 是开始使用 OpenClaw 的最快方式。它封装了复杂的配置流程,通过交互式向导让新用户几分钟内就能启动一个功能完整的 AI 助手服务。

OpenClaw 是开源免费的个人AI助手,支持 WhatsApp、Telegram、Discord 等多平台接入