GKLBB

当你经历了暴风雨,你也就成为了暴风雨

导航

软件研发 --- 安装OpenClaw

一、OpenClaw 快速部署(基于 Kali 2026)

步骤 1:配置 APT 国内源

 
curl -fsSL https://gitee.com/auto-scripts/shell/raw/master/set_kali_source.sh | 

步骤 2:安装 npm

 
apt update
apt install npm -y

步骤 3:设置 npm 国内镜像源

 
npm config set registry http://mirrors.cloud.tencent.com/npm/

步骤 4:一键安装 OpenClaw

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

步骤 5:安装交互选项依次选择

  1. 个人使用确认 → 选 Yes
  2. 安装模式 → 选 QuickStart
  3. 模型提供商 → 选 DeepSeek (API key) 最新版也支持ollama了
  4. 输入 API Key → 粘贴你的 DeepSeek API Key(如 sk-50388e48182b4cbcb6b7xxxxx
  5. 默认模型 → 选 Keep current (deepseek/deepseek-chat)
  6. 频道配置 → 选 Skip for now
  7. 搜索功能 → 选 Skip for now
  8. 技能配置 → 选 No
  9. 启用 Hooks → 空格选中以下 4 项:
    • boot-md
    • bootstrap-extra-files
    • command-logger
    • session-memory
  10. 启动方式 → 选 Open the Web UI

步骤 6:获取 DeepSeek API Key(前置准备)

步骤 7:设置 Web UI 为中文

  • 在 Web UI 界面中切换语言设置

步骤 8:后续启动 OpenClaw

 
openclaw dashboard

或通过浏览器直接访问保存的地址(含 token)。

步骤 9:查看网关状态

 
openclaw gateway status

步骤 10:网关异常时修复

 
# 重启网关
openclaw gateway restart

# 若仍异常,运行诊断修复(一路回车)
openclaw doctor

# 再次确认状态
openclaw gateway status

步骤 11:更新 OpenClaw

 
openclaw update

二、配置局域网访问 OpenClaw

步骤 1:允许局域网访问

 
openclaw config set gateway.bind lan

步骤 2:允许非安全认证

 
openclaw config set gateway.controlUi.allowInsecureAuth true

步骤 3:(可选)禁用设备认证

 
openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true

步骤 4:获取本机局域网 IP

 
ifconfig

步骤 5:配置允许的来源 Origins

 
openclaw config set 'gateway.controlUi.allowedOrigins' '["http://192.168.1.53:18789"]'

将 192.168.1.53 替换为你实际的 IP

步骤 6:重启网关

 
openclaw gateway restart

步骤 7:验证服务状态

 
openclaw gateway status

步骤 8:从其他设备访问

 
# 获取 Token
cat ~/.openclaw/openclaw.json | grep token

在浏览器访问:

text
http://<你的IP>:18789/#token=<你的token>

三、OpenClaw 接入飞书

步骤 1:创建飞书应用

  1. 访问 https://open.feishu.cn/ ,注册并登录
  2. 创建应用,名称如 OpenClaw 助手
  3. 添加能力:机器人

步骤 2:导入权限

  • 在应用权限页面,导入文档中提供的完整 JSON 权限配置
  • 申请开通权限
导入权限:
{
 "scopes": {
 "tenant": [
 "contact:contact.base:readonly",
 "docx:document:readonly",
 "im:chat:read",
 "im:chat:update",
 "im:message.group_at_msg:readonly",
 "im:message.p2p_msg:readonly",
 "im:message.pins:read",
 "im:message.pins:write_only",
 "im:message.reactions:read",
 "im:message.reactions:write_only",
 "im:message:readonly",
 "im:message:recall",
 "im:message:send_as_bot",
 "im:message:send_multi_users",
 "im:message:send_sys_msg",
 "im:message:update",
 "im:resource",
 "application:application:self_manage",
 "cardkit:card:write",
 "cardkit:card:read"
 ],
 "user": [
 "contact:user.employee_id:readonly",
 "offline_access","base:app:copy",
 "base:field:create",
 "base:field:delete",
 "base:field:read",
 "base:field:update",
 "base:record:create",
 "base:record:delete",
 "base:record:retrieve",
 "base:record:update",
 "base:table:create",
 "base:table:delete",
 "base:table:read",
 "base:table:update",
 "base:view:read",
 "base:view:write_only",
 "base:app:create",
 "base:app:update",
 "base:app:read",
 "sheets:spreadsheet.meta:read",
 "sheets:spreadsheet:read",
 "sheets:spreadsheet:create",
 "sheets:spreadsheet:write_only",
 "docs:document:export",
 "docs:document.media:upload",
 "board:whiteboard:node:create",
 "board:whiteboard:node:read",
 "calendar:calendar:read",
 "calendar:calendar.event:create",
 "calendar:calendar.event:delete",
 "calendar:calendar.event:read",
 "calendar:calendar.event:reply",
 "calendar:calendar.event:update",
 "calendar:calendar.free_busy:read",
 "contact:contact.base:readonly",
 "contact:user.base:readonly",
 "contact:user:search",
 "docs:document.comment:create",
 "docs:document.comment:read",
 "docs:document.comment:update",
 "docs:document.media:download",
 "docs:document:copy",
 "docx:document:create",
 "docx:document:readonly",
 "docx:document:write_only",
 "drive:drive.metadata:readonly",
 "drive:file:download",
 "drive:file:upload",
 "im:chat.members:read",
 "im:chat:read",
 "im:message",
 "im:message.group_msg:get_as_user",
 "im:message.p2p_msg:get_as_user",
 "im:message:readonly",
 "search:docs:read",
 "search:message",
 "space:document:delete",
 "space:document:move",
 "space:document:retrieve",
 "task:comment:read",
 "task:comment:write",
 "task:task:read",
 "task:task:write",
 "task:task:writeonly",
 "task:tasklist:read",
 "task:tasklist:write",
 "wiki:node:copy",
 "wiki:node:create",
 "wiki:node:move",
 "wiki:node:read",
 "wiki:node:retrieve",
 "wiki:space:read",
 "wiki:space:retrieve",
 "wiki:space:write_only"
 ]
 }
}

 

步骤 3:发布应用

  1. 创建版本(如 1.0.1
  2. 填写更新说明
  3. 确认发布
  4. 复制 App ID 和 App Secret

步骤 4:在 Kali 中安装飞书插件

 
openclaw channels add

步骤 5:安装交互选项依次选择

  1. Configure chat channels → 选 Yes
  2. Select a channel → 选 Feishu/Lark (飞书)
  3. Install method → 选 Download from npm (@openclaw/feishu)
  4. 输入 App Secret → 粘贴飞书应用的 App Secret
  5. 输入 App ID → 粘贴飞书应用的 App ID
  6. 连接模式 → 选 WebSocket (default)
  7. 域名版本 → 选 Feishu (feishu.cn) - China
  8. 群聊策略 → 选 Open - respond in all groups (requires mention)
  9. 选择频道 → 选 Finished 结束
  10. DM 策略 → 选 No
  11. 显示名称 → 选 No
  12. 绑定 Agent → 选 Yes
  13. 路由 → 选 main (default)

步骤 6:飞书后台配置事件与回调

  1. 事件配置:订阅方式长连接,添加事件:接收消息、消息被 reaction、消息被取消 reaction
  2. 回调配置:选择 长连接
  3. 添加回调:卡片回传交互
  4. 重新发布应用

步骤 7:飞书端配对

  1. 在飞书中给你的机器人名称,发送任意消息(如"你好")
  2. 机器人返回配对码(如 TWC8XXXX
  3. 在 Kali 终端执行:
 
openclaw pairing approve feishu TWC8XXXX --notify
  1. 配对成功后会收到测试消息

步骤 8:验证

  • 在飞书发送"你好",确认正常回复
  • 在 Web UI 查看所有 Session

步骤 9:(如遇问题)修改 Tools Access

  • 在 Web UI 中将 Tools Access 策略修改为 Full

四、飞书可选配置

切换流式输出

 
# 开启
openclaw config set channels.feishu.streaming true

# 关闭
openclaw config set channels.feishu.streaming false

流式卡片显示更多信息

 
openclaw config set channels.feishu.footer.elapsed true
openclaw config set channels.feishu.footer.status true

开启话题独立上下文(多任务并行)

 
# 开启
openclaw config set channels.feishu.threadSession true

# 关闭
openclaw config set channels.feishu.threadSession false

群内回复模式配置

模式 1:需要 @机器人 才回复(推荐)

 
openclaw config set channels.feishu.requireMention true --json
openclaw gateway restart

模式 2:所有消息都回复(慎用)

 
openclaw config set channels.feishu.requireMention false --json
openclaw gateway restart

模式 3:指定群 @机器人 才回复

 
# 默认所有群不需要@
openclaw config set channels.feishu.requireMention open --json

# 特定群需要@(替换群ID)
openclaw config set channels.feishu.groups.oc_xxxxxxxx.requireMention true --json

# 重启生效
openclaw gateway restart

posted on 2026-03-28 06:03  GKLBB  阅读(64)  评论(0)    收藏  举报