OpenClaw 快速入门:10 分钟完成本地安装与配置(附常用命令速查)

OpenClaw 部署与使用指南

OpenClaw 是一个开源的个人 AI 助手项目,2026 年 1 月在 GitHub 上火了起来。和其他只能聊天的 AI 不同,OpenClaw 可以直接操作你的系统------读写文件、执行命令、跑代码、操作浏览器、处理邮件等等。

简单说,它不是和你对话的工具,而是帮你干活的工具。


关于项目名称

你可能看到过三个名字:Clawdbot、Moltbot、OpenClaw。这是一个项目:

  • 最早叫 Clawdbot
  • 1 月底因为商标问题改名为 Moltbot
  • 最后定名为 OpenClaw

功能完全一样,命令也兼容。


本地安装

一键安装

最简单的方式,直接运行安装脚本:

macOS/Linux:

bash 复制代码
curl -fsSL https://openclaw.ai/install.sh | bash

Windows PowerShell:

powershell 复制代码
iwr -useb https://openclaw.ai/install.ps1 | iex

Windows CMD:

cmd 复制代码
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

手动安装

如果已经装了 Node.js ≥22:

bash 复制代码
npm i -g openclaw
# 或
pnpm add -g openclaw

然后运行初始化:

bash 复制代码
openclaw onboard

从源码安装

bash 复制代码
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build
pnpm build
pnpm openclaw onboard --install-daemon
pnpm gateway:watch

初始化配置

安装完成后会进入配置向导,几个关键选项说明一下:

风险确认:OpenClaw 需要系统权限来完成任务,选 Yes 继续。

安装模式:新手选 QuickStart 即可。

AI 模型

国内用户可以用 Qwen、MiniMax、智谱。有海外账号的推荐 Claude 或 GPT-4。暂时不确定可以先跳过,后面通过配置文件改。

聊天通道

海外用户选 WhatsApp/Telegram/Discord,国内用户可以跳过,后面配置飞书。

端口:默认 18789,不用改。

配置完成后浏览器会自动打开 http://127.0.0.1:18789/chat


云服务器部署

阿里云和腾讯云都有现成的镜像,可以直接用。

阿里云

https://www.aliyun.com/activity/ecs/clawdbot

腾讯云

https://cloud.tencent.com/developer/article/2624973

步骤:

  1. 用 OpenClaw 镜像重装系统(注意不是 Moltbot)

  2. 登录服务器终端,运行 openclaw onboard

后续配置和本地安装一样。如果要用国内模型,建议先跳过模型配置,后面手动改配置文件。


公网访问配置

云服务器部署后如果需要从外网访问,需要额外配置。

WebSocket 配置

接入 Telegram/WhatsApp 等需要:

bash 复制代码
openclaw configure

把 Gateway 地址改成公网 IP:

认证方式选 Token。

Web UI 远程访问

编辑 ~/.openclaw/openclaw.json,把 mode 改成 remotebind 改成 lan,然后重启服务。

bash 复制代码
openclaw gateway stop
openclaw gateway start

查看 token:

bash 复制代码
cat ~/.openclaw/openclaw.json

访问 URL 加上 &token=xxx

设备授权

如果出现 pairing required 错误:

bash 复制代码
openclaw devices list

复制 Pending 里的 Request ID 授权:

bash 复制代码
openclaw devices approve b8eb70dd...

国内模型配置

Moonshot (Kimi)

  1. 创建 API Key:https://platform.moonshot.cn/console/api-keys
  2. 查看可用模型:https://platform.moonshot.cn/playground

Kimi Code

  1. 购买编程模型:https://www.kimi.com/code

  2. 创建 API Key:https://www.kimi.com/code/console?from=kfc_overview_topbar

修改配置文件

编辑 ~/.openclaw/openclaw.json,把下面的内容加进去(替换 API Key):

json 复制代码
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "moonshot/kimi-k2.5"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      },
      "workspace": "/root/.openclaw/workspace"
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "moonshot": {
        "baseUrl": "https://api.moonshot.cn/v1",
        "apiKey": "${MOONSHOT_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "kimi-k2.5",
            "name": "Kimi K2.5"
          }
        ]
      },
      "kimi-code": {
        "baseUrl": "https://api.kimi.com/coding/v1",
        "apiKey": "${KIMICODE_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "kimi-for-coding",
            "name": "Kimi For Coding"
          }
        ]
      }
    }
  }
}

重启服务生效:

bash 复制代码
openclaw gateway restart

飞书集成

1. 创建飞书应用

打开 https://open.feishu.cn/app,创建应用,添加机器人能力。

2. 配置权限

开通消息和群组相关权限。

3. 配置事件

使用长连接,添加消息接收事件。

4. 连接 OpenClaw

bash 复制代码
openclaw configure

选择 Channels,填入飞书的 App ID 和 App Secret。


常用命令

基础

bash 复制代码
openclaw status          # 运行状态
openclaw health          # 健康检查
openclaw doctor          # 诊断问题
openclaw doctor --deep   # 深度检查
openclaw configure       # 修改配置

Gateway

bash 复制代码
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway status

通道

bash 复制代码
openclaw channels list
openclaw channels login           # WhatsApp 扫码
openclaw channels add             # 添加 Telegram/Discord
openclaw channels status --probe

模型

bash 复制代码
openclaw models list
openclaw models status
openclaw models auth setup-token

配置

bash 复制代码
openclaw config get <path>
openclaw config set <path> <value>
openclaw config unset <path>

日志

bash 复制代码
openclaw logs
openclaw logs --follow

记忆和技能

bash 复制代码
openclaw memory search "关键词"
openclaw memory index
openclaw skills list
clawhub install <skill>

文件路径

路径 用途
~/.openclaw/openclaw.json 主配置文件
~/.openclaw/workspace/ 工作区
~/.openclaw/credentials/ API 密钥
~/.openclaw/memory/ 长期记忆存储
~/.openclaw/skills/ 技能目录
/tmp/openclaw/*.log 日志文件

工作区文件:

  • AGENTS.md - 给 AI 的指令
  • USER.md - 用户偏好
  • MEMORY.md - 长期记忆
  • HEARTBEAT.md - 定期检查清单
  • SOUL.md - 人格设定
  • BOOT.md - 启动配置

聊天命令

在聊天界面可以用:

复制代码
/status              查看状态
/context list        查看上下文
/model <模型>        切换模型
/compact             精简窗口
/new                 新对话
/stop                停止任务
/tts on/off          语音开关
/think               切换推理模式

常见问题

问题 解决
不回消息 openclaw status
私信没反应 openclaw devices list 批准设备
群里不响应 检查提及模式
认证过期 openclaw models auth setup-token
服务异常 openclaw doctor --deep
记忆问题 openclaw memory index

参考链接


相关推荐
板子~1 天前
OpenClaw + macOS(Mac mini)+ Tailscale Serve 远程访问踩坑全记录:从“能打开但离线”到稳定可用的修复路线
tailscale·openclaw
vibecoding日记2 天前
OpenClaw 插件系统:如何打造全能私人助理 --OpenClaw源码系列第2期
产品·ai助手·openclaw
Johny_Zhao2 天前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
GPUStack4 天前
Token 不再焦虑:用 GPUStack + OpenClaw 搭一个“无限用”的本地 AI 助手
ai·模型推理·gpustack·openclaw
坐吃山猪8 天前
OpenClaw04_Gateway常见问题
网络·gateway·openclaw
Blockchina8 天前
OpenClaw 深度搭建与运行实录
ai agent·openclaw
行走的小派8 天前
普惠新篇章:香橙派全志系列开发板全面拥抱OpenClaw时代
全志·openclaw
冀博8 天前
2026爆款AI Agent|OpenClaw从入门到中级实操指南(含飞书对接+多Agent配置+避坑指南)
人工智能·飞书·openclaw
小马过河R8 天前
OpenClaw 记忆系统工作原理
人工智能·机器学习·语言模型·agent·openclaw·智能体记忆机制