OpenClaw安装部署

概述

GitHub:

文档:

技能市场:

核心特点

多渠道通信:OpenClaw 可以在众多平台上与你交流:

即时通讯:WhatsApp、T@elegrimm、Slack、Discord、Signal、iMessage

工作工具:Google Chat、Microsoft Teams、Feishu

其他:Matrix、Zalo、WebChat

多AI 模型支持:支持任何 OpenAI 兼容的 LLM(Claude、GPT-5、Deepseek 等)

推荐:Anthropic Claude(最强的长上下文和安全性)

可配置模型失效切换(自动备选方案)

强大的工具集

浏览器控制:自动化网络任务

Canvas 画布:可视化工作区

设备连接:iOS/Android/macOS

Cron 任务:定时自动化

Webhook:外部集成触发

隐私与控制

数据留在你的设备上

没有云服务,完全本地

完全控制模型和配置

安全的设备配对机制

安装方式

前置条件

Windows系统:

powershell -c "irm x"

choco install nodejs --version="24.14.0"

node -v 

npm -v 

Linux系统:

curl -o-  | bash

. "$HOME/.nvm/nvm.sh"

nvm install 24

node -v 

npm -v 

脚本安装

Linux、Mac:

curl -fsSL  | bash

Windows(PowerShell):

iwr -useb  | iex

手动NPM安装

全局安装openclaw

npm install -g openclaw@latest

运行新手引导向导(并安装服务)

openclaw onboard --install-daemon

源代码构建安装

git clone 
cd openclaw
pnpm install
pnpm ui:build # 首次运行时自动安装 UI 依赖
pnpm build
openclaw onboard --install-daemon

Docker安装

在使用云服务基于Docker方式安装时遇到问题不少,特此额外记录下。

基于本地Docker安装可能没什么问题,经过一段时间使用经验来说,OpenClaw就该部署在本地,操作部署机器上的各种资源,充当你的私人助手。

Docker具体安装方式查阅下文。

开始安装与配置引导

选择NPM安装方式

npm install -g openclaw@latest

openclaw onboard --install-daemon

依赖检测与安装

如果使用脚本安装,在运行脚本后,将会自动检测并安装相关缺失依赖 脚本执行完成后,OpenClaw后会自动打开配置引导 NPM方式安装后需要执行以下命令进入新手引导向导

openclaw onboard --install-daemon

风险提示

选择yes回车,明白相关风险

◆  I understand this is powerful and inherently risky. Continue?
│  ● Yes / ○ No
└

选择操作模式

这里直接选择QuickStart快速启动

◆  Onboarding mode
│  ● QuickStart (Configure details later via openclaw configure.)
│  ○ Manual
└

选择模型供应商

根据需求选择使用那个模型供应商,这里选择的是Qwen

供应商授权或配置API_KEY

这里选择供应商后,复制授权链接到浏览器访问授权

◇  Model/auth provider
│  Qwen
│
◒  Starting Qwen OAuth…│
◇  Qwen OAuth ─────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│  Open  to approve  │
│  access.                                                                             │
│  If prompted, enter the code XXXT9.                                               │
│                                                                                      │
├──────────────────────────────────────────────────────────────────────────────────────╯
◇  Qwen OAuth complete
│
◇  Model configured ─────────────────────────────╮
│                                                │
│  Default model set to qwen-portal/coder-model  │
│                                                │
├────────────────────────────────────────────────╯
│
◇  Provider notes ──────────────────────────────────────────────────────────────────────╮
│                                                                                       │
│  Qwen OAuth tokens auto-refresh. Re-run login if refresh fails or access is revoked.  │
│  Base URL defaults to . Override                             │
│  models.providers.qwen-portal.baseUrl if needed.                                      │
│                                                                                       │
├───────────────────────────────────────────────────────────────────────────────────────╯

完成供应商授权后,设置模型

◆  Default model
│  ● Keep current (qwen-portal/coder-model)
│  ○ Enter model manually
│  ○ qwen-portal/coder-model
│  ○ qwen-portal/vision-model
└

选择聊天渠道

配置Skill

根据需要决定是否需要配置,这里选择Skip for now

◇  Skills status ─────────────╮
│                             │
│  Eligible: 7                │
│  Missing requirements: 41   │
│  Unsupported on this OS: 7  │
│  Blocked by allowlist: 0    │
│                             │
├─────────────────────────────╯
│
◆  Configure skills now? (recommended)
│  ● Yes / ○ No
└

Hooks配置

根据需要决定是否需要配置,这里选择Skip for now

◇  Hooks ──────────────────────────────────────────────────────────────────╮
│                                                                          │
│  Hooks let you automate actions when agent commands are issued.          │
│  Example: Save session context to memory when you issue /new or /reset.  │
│                                                                          │
│  Learn more:                    │
│                                                                          │
├──────────────────────────────────────────────────────────────────────────╯
│
◆  Enable hooks?
│  ◻ Skip for now
│  ◻  boot-md
│  ◻  bootstrap-extra-files
│  ◻  command-logger
│  ◻  session-memory
└

访问

Hooks配置过后将自动启动OpenClaw服务,且控制台打印很多信息,关键的信息如下,包含访问地址与TOKEN值

o  Control UI -------------------------------------------------------------------------------+
|                                                                                            |
|  Web UI:                                                            |
|  Web UI (with token):                                                                      |
|  #token=39c5ba72943aea29463a2dca6230068c7f5fb18fd2bbb234            |
|  Gateway WS: ws://127.0.0.1:18789                                                          |
|  Gateway: not detected (gateway closed (1006 abnormal closure (no close frame)): no close  |
|  reason)                                                                                   |
|  Docs:                                              |
|                                                                                            |
+--------------------------------------------------------------------------------------------

建议复制带Token的URL地址到浏览器访问,例如:,它会自动配置Token信息 否则需要按如下截图处配置Token

测试

随便发送一个提问,简单测试是否配置成功

聊天渠道

进入配置

输入以下命令开始配置OpenClaw

openclaw config

依次选择Local (本机)、Channels (渠道)、Configure/link (配置链接)、选择渠道

 OpenClaw  2026.2.26 (bc50708) — WhatsApp automation without the "please accept our new privacy policy".

▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██
██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██
██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                   OPENCLAW 

T  OpenClaw configure
|
o  Existing config detected ---------+
|                                    |
|  workspace: ~.openclawworkspace  |
|  model: qwen-portal/coder-model    |
|  gateway.mode: local               |
|  gateway.port: 18789               |
|  gateway.bind: loopback            |
|                                    |
+------------------------------------+
|
*  Where will the Gateway run?
|  > Local (this machine) (Gateway reachable (ws://127.0.0.1:18789))
|    Remote (info-only)
—
*  Select sections to configure
|    Workspace
|    Model
|    Web tools
|    Gateway
|    Daemon
|  > Channels (Link WhatsApp/T@elegrimm/etc and defaults)
|    Skills
|    Health check
|    Continue
—

*  Channels
|  > Configure/link (Add/update channels; disable unselected accounts)
|    Remove channel config
—
*  Select a channel
|    T@elegrimm (Bot API)
|    WhatsApp (QR link)
|    Discord (Bot API)
|    IRC (Server + Nick)
|    Google Chat (Chat API)
|    Slack (Socket Mode)
|    Signal (signal-cli)
|    iMessage (imsg)
|  > Feishu/Lark (飞书) (plugin · install)
|    Nostr (NIP-04 DMs)
|    Microsoft Teams (Bot Framework)
|    Mattermost (plugin)
|    Nextcloud Talk (self-hosted)
|    Matrix (plugin)
|    BlueBubbles (macOS app)
|    LINE (Messaging API)
|    Zalo (Bot API)
|    Zalo (Personal Account)
|    Synology Chat (Webhook)
|    Tlon (Urbit)
|    Finished
—

飞书

创建飞书应用

访问飞书开放平台创建应用 得到AppID、AppSecrect 根据使用情况添加对应的权限 也可以根据后台日志提示开通相关权限

openclaw-gateway-1  | 2026-03-01T05:10:44.646Z [feishu] streaming start failed: Error: Create card failed: Access denied. One of the following scopes is required: [cardkit:card:write].应用尚未开通所需的应用身份权限:[cardkit:card:write],点击链接申请并开通任一权限即可:

还可以按官方推荐,批量导入以下权限信息:

{
  "scopes": {
    "tenant": [
      "aily:file:read",
      "aily:file:write",
      "application:application.app_message_stats.overview:readonly",
      "application:application:self_manage",
      "application:bot.menu:write",
      "cardkit:card:write",
      "contact:user.employee_id:readonly",
      "corehr:file:download",
      "docs:document.content:read",
      "event:ip_list",
      "im:ch@t",
      "im:ch@t.access_event.bot_p2p_ch@t:read",
      "im:ch@t.members:bot_access",
      "im:message",
      "im:message.group_at_msg:readonly",
      "im:message.group_msg",
      "im:message.p2p_msg:readonly",
      "im:message:readonly",
      "im:message:send_as_bot",
      "im:resource",
      "sheets:spreadsheet",
      "wiki:wiki:readonly"
    ],
    "user": ["aily:file:read", "aily:file:write", "im:ch@t.access_event.bot_p2p_ch@t:read"]
  }
}

配置事件回调,选择使用长连接接收事件 添加接收消息事件 然后发布应用

配置

需要安装一个飞书插件,执行以下命令进行安装或者配置飞书时根据提示安装

openclaw plugins install @m1heng-clawd/feishu

依次选择飞书聊天通道,分别进行安装插件、输入AppID+AppSecrect、选择中国域名、接受群组聊天策略、完成配置、然后选择YES配置数据访问策略、选择Open、Continue即可

◇  Select channel (QuickStart)
│  Feishu/Lark (飞书)
│
◇  Install Feishu plugin?
│  Download from npm (@openclaw/feishu)
Downloading @openclaw/feishu…
Extracting /tmp/openclaw-npm-pack-dytHGF/openclaw-feishu-2026.2.24.tgz…
Installing to /home/node/.openclaw/extensions/feishu…
Installing plugin dependencies…
02:15:44 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: feishu (/home/node/.openclaw/extensions/feishu/index.ts). Set plugins.allow to explicit trusted ids.
│
◇  Feishu credentials ──────────────────────────────────────────────────────────────╮
│                                                                                   │
│  1) Go to Feishu Open Platform (open.feishu.cn)                                   │
│  2) Create a self-built app                                                       │
│  3) Get App ID and App Secret from Credentials page                               │
│  4) Enable required permissions: im:message, im:ch@t, contact:user.base:readonly  │
│  5) Publish the app or add it to a test group                                     │
│  Tip: you can also set FEISHU_APP_ID / FEISHU_APP_SECRET env vars.                │
│  Docs: feishu                 │
│                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────╯
│
◆  Enter Feishu App ID
│  _
│
◇  Enter Feishu App Secret
│   _
│
◇  Feishu connection test ────────────────────────────╮
│                                                     │
│  Connection failed: API error: app do not have bot  │
│                                                     │
├─────────────────────────────────────────────────────╯
│
◆  Which Feishu domain?
│  ● Feishu (feishu.cn) - China
│  ○ Lark (larksuite.com) - International
*  Group ch@t policy
|    Allowlist - only respond in specific groups
|  > Open - respond in all groups (requires mention)
|    Disabled - don't respond in groups
│
o  Selected channels ------------------------------------------+
|                                                              |
|  Finished      											   |
|                                                              |
+--------------------------------------------------------------+
|
o  Configure DM access policies now? (default: pairing)
|  Yes
o  Feishu DM policy
|  Open (public inbound DMs)
|
o  Select sections to configure
|  Continue

添加设备

第一次对话,从新设备连到Gateway时,需要做一次性设备配对批准 根据提示执行对应命令即可

# 查看所有设备
openclaw devices list

# 批准硬件设备
openclaw devices approve <requestId>

# 批准聊天渠道设备
openclaw pairing approve feishu KZXXX

验证

在飞书客户端搜索到创建的应用 再对话进行验证

异常

注意:在Windows环境下遇到了如下错误

C:XXXXXX>openclaw plugins install @m1heng-clawd/feishu

 OpenClaw  2026.2.26 (bc50708) — Claws out, commit inlet's ship something mildly responsible.

Downloading @m1heng-clawd/feishu…
[openclaw] Failed to start CLI: Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:796:9)
    at runCommandWithTimeout ()
    at packNpmSpecToArchive ()
    at 
    at withTempDir ()
    at async installFromNpmSpecArchive ()
    at async installFromNpmSpecArchiveWithInstaller ()
    at async installPluginFromNpmSpec ()
    at async Command.<anonymous> ()

根据提示,修改exec-BhaMholX.js文件的runCommandWithTimeout函数,大概196行的位置,使用以下代码替换对应代码片段后重新执行安装

	const isWindows = process.platform === "win32";
	const child = spawn(resolvedCommand, argv.slice(1), {
		stdio,
		cwd,
		env: resolvedEnv,
		shell: isWindows,
		windowsVerbatimArguments: isWindows ? false : windowsVerbatimArguments,
	});

TG

创建Boot

与@BotFather对话,输入/newbot,根据提示操作创建Boot,得到Token

添加配置

1.直接喊OpenClaw配置TG

2.直接修改~/.openclaw/openclaw.json文件添加对应聊天通道

{
  "channels": {
    "telegram": {
      "enabled": true,
      "dmPolicy":  "pairing",
      "botToken": "xxxxxxxxxxx",
      "groupPolicy": "allowlist",
      "streaming":  "off",
      "proxy": "http://127.0.0.1:5555" # 如果环境不允许,需要增加该参数
    },
  },
}

添加设备

在TG机器人输入/start,首次访问会生成配对码

OpenClaw: access not configured.

Your T@elegrimm user id: 123456789

Pairing code: VR6XXX

Ask the bot owner to approve with:
openclaw pairing approve telegram VR6XXX

使用openclaw进行配对

openclaw pairing approve telegram VR6XXX

常用命令

命令功能
openclaw onboard重新进入配置向导
openclaw onboard --install-daemon重新进入配置向导并安装服务
openclaw config配置
openclaw status查看运行状态
openclaw gateway --port 18789 --verbose指定端口且前台运行
openclaw health健康检查
openclaw gateway start启动服务
openclaw gateway restart重启服务
openclaw gateway stop停止服务
openclaw logs --follow查看实时日志
openclaw update更新到最新版本
openclaw doctor诊断问题
openclaw doctor --fix尝试自动修正错误
openclaw uninstall卸载 OpenClaw
openclaw channels add渠道添加
openclaw plugins list查看可用插件
openclaw devices list查看所有设备
openclaw devices approve 批准硬件设备
openclaw pairing approve feishu KZXXX批准聊天渠道设备

Docker安装

克隆项目到本地并进入

git clone 
cd openclaw

解决网络访问问题

修改docker-compose.yml,让openclaw-cliopenclaw-gateway能正常通信

openclaw-cli:
  depends_on:
    - openclaw-gateway
  environment:
    OPENCLAW_GATEWAY_URL: ws://openclaw-gateway:18789

修改~/.openclaw/openclaw.json,让openclaw-gateway使用Docker桥接网络

"gateway": {
  "bind": "lan"
}

解决权限问题

在 执行./docker-setup.sh 启动镜像之后,出现一个权限错误:

Error: EACCES: permission denied, open '/home/node/.openclaw/openclaw.json

授权容器用户(uid=1000)写入root或其他用户拥有目录的权限

chown -R 1000:1000 "$HOME/.openclaw"

启动脚本

执行脚本后会自动启动openclaw容器,参考上文开始安装与配置引导继续后续操作

./docker-setup.sh

同步Gateway Token

执行docker-setup.sh时将在.env文件生成一个令牌,确保~/.openclaw/openclaw.jsongateway.auth.token .env文件中的 OPENCLAW_GATEWAY_TOKEN 值一致。

  "gateway": {
    "auth": {
      "mode": "token",
      "token": "8869f81f1b0b75c5d0176xxxxxxeb1b0d22e3fc6737"
    }
OPENCLAW_GATEWAY_BIND=lan
OPENCLAW_GATEWAY_TOKEN=8869f81f1b0b75c5d0176xxxxxxeb1b0d22e3fc6737
OPENCLAW_IMAGE=openclaw:local

重启openclaw-gateway使配置生效

docker compose restart openclaw-gateway

浏览器访问

1.明确指定允许访问的来源

gateway:
  controlUi:
    allowedOrigins:
      - "https://your-admin-domain.com"
      - "http://192.168.1.100"

2.让网关直接信任任何访问来源

  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "dangerouslyAllowHostHeaderOriginFallback": true
    },

配置后虽然能访问了,但是又遇到http无法访问,要求使用HTTPS访问 解决方案:

1.开启 HTTPS,利用Nginx创建一个反向代理站点即可

2.修改网关配置来跳过这个限制,网关将只依赖 Token 进行身份验证 (无效,可能是Docker部署导致)

  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "lan",
    "controlUi": {
      "dangerouslyAllowHostHeaderOriginFallback": true,
      "allowInsecureAuth":true
    },

3.使用SSH隧道 在本地终端执行以下命令后,浏览器直接访问127.0.0.1:18789即可

ssh -L 18789:127.0.0.1:18789 <user>@<remote_host>

常用命令

命令说明
docker compose run --rm openclaw-cli onboard重新完成初始化向导
docker compose restart openclaw-gateway重启网关
docker compose run --rm openclaw-cli config配置
docker compose run --rm openclaw-cli pairing approve feishu KZXXXX添加设备
docker compose up -d --force-recreate openclaw-gateway当修改过docker-compose.yml时重建容器
docker compose logs -f日志查看
本站提供的所有下载资源均来自互联网,仅提供学习交流使用,版权归原作者所有。如需商业使用,请联系原作者获得授权。 如您发现有涉嫌侵权的内容,请联系我们 邮箱:alixiixcom@163.com