610 字
3 分钟
OpenClaw安装与诊断操作指南

OpenClaw 安装与诊断操作指南#

OpenClaw 是个很有意思的框架,可以在本地部署 AI 助手并通过 Telegram 控制。安装过程中踩了一些坑,记录一下解决方案。

安装步骤#

官方安装脚本#

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

安装过程分三步:

  1. 检查系统依赖
  2. 安装 OpenClaw npm 包
  3. 运行首次配置向导

内存不足问题#

如果服务器内存较小(<2GB),可能会遇到 npm 安装失败:

npm install failed for openclaw@latest

解决方案:增加 Node.js 内存限制

Terminal window
# 临时设置环境变量(当前会话有效)
export NODE_OPTIONS="--max-old-space-size=4096"
# 然后重新运行安装脚本
curl -fsSL https://openclaw.ai/install.sh | bash
# 或者只运行失败的步骤
NODE_OPTIONS="--max-old-space-size=4096" npm install -g openclaw@latest
内存设置
  • 4096 表示 4GB,根据你的服务器内存调整
  • 如果 4GB 不够,尝试 8192(8GB)

验证安装#

Terminal window
openclaw --version
openclaw doctor

Doctor 诊断报告解读#

运行 openclaw doctor 后会看到类似这样的报告:

🦞 OpenClaw 2026.2.24 (df9a474)
┌ OpenClaw doctor
◇ Legacy state detected
│ - Sessions: canonicalize legacy keys in
│ /root/.openclaw/agents/main/sessions/sessions.json
◇ Doctor changes
│ Merged sessions store → /root/.openclaw/agents/main/sessions/sessions.json
│ Canonicalized 1 legacy session key(s)
◇ State integrity
│ - 2/4 recent sessions are missing transcripts.
◇ Security
│ - No channel security warnings detected.
│ - Run: openclaw security audit --deep
◇ Skills status
│ Eligible: 17
│ Missing requirements: 42
◇ Plugins
│ Loaded: 5
│ Disabled: 31
│ Errors: 0
◇ Telegram: ok (@yourbot) (2844ms)
└ Doctor complete.

建议操作#

1. 清理异常会话数据#

Terminal window
# 查看会话存储
openclaw sessions --store "/root/.openclaw/agents/main/sessions/sessions.json"
# 预览清理影响(干运行)
openclaw sessions cleanup --store "/root/.openclaw/agents/main/sessions/sessions.json" --dry-run
# 实际清理
openclaw sessions cleanup --store "/root/.openclaw/agents/main/sessions/sessions.json"

2. 执行深度安全审计#

Terminal window
openclaw security audit --deep

3. 检查缺失的技能依赖#

报告显示有 42 个技能因缺少依赖无法使用。需要检查:

  • API Key 是否配置
  • 依赖库是否安装
  • 环境变量是否设置
Terminal window
# 查看技能状态
openclaw skills list
# 查看具体技能的依赖
openclaw skills info <skill-name>

4. 启用插件#

31 个插件处于禁用状态,按需启用:

Terminal window
# 列出插件
openclaw plugins list
# 启用插件
openclaw plugins enable <plugin-name>

常用命令#

Terminal window
# 查看帮助
openclaw --help
# 查看代理状态
openclaw agents list
# 查看会话
openclaw sessions list
# 查看日志
openclaw logs
# 重启服务
openclaw restart
# 完全重置(慎用)
openclaw reset

配置文件位置#

/root/.openclaw/
├── agents/
│ └── main/
│ └── sessions/
│ └── sessions.json # 会话数据
├── config.json # 主配置
└── plugins/ # 插件目录

参考链接#

OpenClaw安装与诊断操作指南
https://im.awsl.app/posts/ai-automation/053-openclaw-install-guide/
作者
uu
发布于
2026-03-10
许可协议
CC0 1.0