<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Tutorial on ZORAN</title>
    <link>https://zoranzhou.com/tags/tutorial/</link>
    <description>Recent content in Tutorial on ZORAN</description>
    <image>
      <url>https://zoranzhou.com/favicon.png</url>
      <link>https://zoranzhou.com/favicon.png</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 05 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://zoranzhou.com/tags/tutorial/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>OpenClaw 完全安装指南与命令详解</title>
      <link>https://zoranzhou.com/posts/openclaw-complete-guide/</link>
      <pubDate>Thu, 05 Mar 2026 00:00:00 +0000</pubDate>
      
      <guid>https://zoranzhou.com/posts/openclaw-complete-guide/</guid>
      <description>基于官方文档的 OpenClaw AI 助手完整安装教程，涵盖多种安装方式、配置详解及常用命令汇总</description>
      <content:encoded><![CDATA[<h1 id="前言">前言</h1>
<p>OpenClaw 是一个强大的 AI 助手平台，支持多代理架构、浏览器自动化、定时任务、跨平台消息推送等丰富功能。本文将基于官方文档，详细介绍 OpenClaw 的完整安装流程、配置方法以及日常使用中的各类命令。</p>
<hr>
<h1 id="系统要求">系统要求</h1>
<p>在安装 OpenClaw 之前，请确保你的系统满足以下要求：</p>
<ul>
<li><strong>Node.js</strong>: 22 或更高版本（安装脚本会自动安装）</li>
<li><strong>操作系统</strong>: macOS、Linux 或 Windows</li>
<li><strong>包管理器</strong>: npm（必需）或 pnpm（源码安装时需要）</li>
</ul>
<!-- raw HTML omitted -->
<hr>
<h1 id="安装方法">安装方法</h1>
<h2 id="方法一安装脚本推荐">方法一：安装脚本（推荐）</h2>
<p>安装脚本是最简单的方式，它会自动处理 Node 检测、安装和初始化向导。</p>
<h3 id="macos--linux--wsl2">macOS / Linux / WSL2</h3>
<pre tabindex="0"><code>curl -fsSL https://openclaw.ai/install.sh | bash
</code></pre><h3 id="windows-powershell">Windows (PowerShell)</h3>
<pre tabindex="0"><code>iwr -useb https://openclaw.ai/install.ps1 | iex
</code></pre><p><strong>跳过初始化向导，仅安装二进制文件：</strong></p>
<pre tabindex="0"><code># macOS / Linux / WSL2
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard

# Windows PowerShell
&amp; ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -NoOnboard
</code></pre><h2 id="方法二npm--pnpm-安装">方法二：npm / pnpm 安装</h2>
<p>如果你已经安装了 Node 22+，可以手动管理安装：</p>
<h3 id="使用-npm">使用 npm</h3>
<pre tabindex="0"><code>npm install -g openclaw@latest
openclaw onboard --install-daemon
</code></pre><!-- raw HTML omitted -->
<pre tabindex="0"><code>SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
</code></pre><!-- raw HTML omitted -->
<h3 id="使用-pnpm">使用 pnpm</h3>
<pre tabindex="0"><code>pnpm add -g openclaw@latest
pnpm approve-builds -g        # 批准构建脚本
openclaw onboard --install-daemon
</code></pre><!-- raw HTML omitted -->
<h2 id="方法三从源码安装">方法三：从源码安装</h2>
<p>适合贡献者或想要本地运行的用户。</p>
<pre tabindex="0"><code># 1. 克隆仓库并构建
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install
pnpm ui:build
pnpm build

# 2. 链接 CLI 到全局
pnpm link --global

# 3. 运行初始化向导
openclaw onboard --install-daemon
</code></pre><!-- raw HTML omitted -->
<h2 id="方法四docker--podman">方法四：Docker / Podman</h2>
<p>适合容器化或 headless 部署：</p>
<pre tabindex="0"><code># Docker
docker run -it --rm openclaw/openclaw:latest

# Podman（rootless）
# 先运行 setup-podman.sh，然后使用启动脚本
</code></pre><p>其他安装方式：</p>
<ul>
<li><strong>Nix</strong>: 声明式安装</li>
<li><strong>Ansible</strong>: 自动化集群部署</li>
<li><strong>Bun</strong>: 仅 CLI 使用</li>
</ul>
<hr>
<h1 id="安装后验证">安装后验证</h1>
<p>安装完成后，运行以下命令验证一切正常：</p>
<pre tabindex="0"><code># 检查配置问题
openclaw doctor

# 查看网关状态
openclaw status

# 打开浏览器控制面板
openclaw dashboard
</code></pre><hr>
<h1 id="初始化配置">初始化配置</h1>
<h2 id="运行初始化向导">运行初始化向导</h2>
<pre tabindex="0"><code>openclaw onboard
</code></pre><p>向导会引导你完成：</p>
<ol>
<li>工作区设置</li>
<li>模型提供商配置（API Key）</li>
<li>消息通道配置（WhatsApp、Telegram、Discord 等）</li>
<li>技能安装</li>
<li>网关服务安装</li>
</ol>
<h2 id="常用配置选项">常用配置选项</h2>
<h3 id="非交互式配置">非交互式配置</h3>
<pre tabindex="0"><code># 快速模式
openclaw onboard --non-interactive --mode local

# 指定模型提供商
openclaw onboard --auth-choice openai-api-key --openai-api-key $OPENAI_API_KEY

# 远程网关模式
openclaw onboard --mode remote --remote-url https://gateway.example.com --remote-token $TOKEN
</code></pre><h3 id="配置模型">配置模型</h3>
<pre tabindex="0"><code># 查看模型状态
openclaw models status

# 设置主模型
openclaw models set moonshot/kimi-k2.5

# 设置图像模型
openclaw models set-image openai/gpt-4o

# 添加模型别名
openclaw models aliases add kimi moonshot/kimi-k2.5

# 配置模型认证
openclaw models auth add
openclaw models auth setup-token --provider anthropic
</code></pre><hr>
<h1 id="核心命令详解">核心命令详解</h1>
<h2 id="基础命令">基础命令</h2>
<table>
  <thead>
      <tr>
          <th>命令</th>
          <th>说明</th>
          <th>示例</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>openclaw --version</code></td>
          <td>查看版本</td>
          <td><code>openclaw -V</code></td>
      </tr>
      <tr>
          <td><code>openclaw --help</code></td>
          <td>显示帮助</td>
          <td><code>openclaw --help</code></td>
      </tr>
      <tr>
          <td><code>openclaw doctor</code></td>
          <td>健康检查</td>
          <td><code>openclaw doctor --deep</code></td>
      </tr>
      <tr>
          <td><code>openclaw status</code></td>
          <td>查看状态</td>
          <td><code>openclaw status --usage</code></td>
      </tr>
      <tr>
          <td><code>openclaw dashboard</code></td>
          <td>打开控制面板</td>
          <td><code>openclaw dashboard</code></td>
      </tr>
  </tbody>
</table>
<h2 id="配置管理">配置管理</h2>
<pre tabindex="0"><code># 交互式配置向导
openclaw configure

# 获取配置值
openclaw config get agents.defaults.model.primary

# 设置配置值
openclaw config set agents.defaults.model.primary moonshot/kimi-k2.5

# 验证配置
openclaw config validate

# 查看配置文件路径
openclaw config file
</code></pre><h2 id="网关管理">网关管理</h2>
<pre tabindex="0"><code># 查看网关状态
openclaw gateway status

# 安装网关服务
openclaw gateway install --port 18789

# 启动/停止/重启网关
openclaw gateway start
openclaw gateway stop
openclaw gateway restart

# 查看日志
openclaw logs --follow
openclaw logs --limit 200
</code></pre><h2 id="会话管理">会话管理</h2>
<pre tabindex="0"><code># 列出所有会话
openclaw sessions list

# 查看会话历史
openclaw sessions history agent:main:main

# 向会话发送消息
openclaw sessions send agent:main:main &#34;你好&#34;
</code></pre><h2 id="技能管理">技能管理</h2>
<pre tabindex="0"><code># 列出已安装技能
openclaw skills list

# 查看技能详情
openclaw skills info agent-browser

# 检查技能就绪状态
openclaw skills check

# 从 ClawdHub 搜索技能
npx clawhub search browser

# 安装技能
npx clawhub install agent-browser
</code></pre><h2 id="消息通道管理">消息通道管理</h2>
<pre tabindex="0"><code># 列出配置的通道
openclaw channels list

# 检查通道状态
openclaw channels status --probe

# 查看通道日志
openclaw channels logs --lines 100

# 添加 Telegram 机器人
openclaw channels add --channel telegram --account alerts --name &#34;Alerts Bot&#34; --token $TELEGRAM_BOT_TOKEN

# 添加 Discord 机器人
openclaw channels add --channel discord --account work --name &#34;Work Bot&#34; --token $DISCORD_BOT_TOKEN

# 移除通道
openclaw channels remove --channel discord --account work --delete
</code></pre><h2 id="代理管理">代理管理</h2>
<pre tabindex="0"><code># 列出代理
openclaw agents list

# 添加新代理
openclaw agents add my-agent --workspace /path/to/workspace

# 绑定通道到代理
openclaw agents bind --agent my-agent --bind telegram:alerts

# 解绑通道
openclaw agents unbind --agent my-agent --bind telegram:alerts

# 删除代理
openclaw agents delete my-agent
</code></pre><h2 id="浏览器自动化">浏览器自动化</h2>
<pre tabindex="0"><code># 启动浏览器
openclaw browser start

# 打开网页
openclaw browser open https://example.com

# 获取页面快照
openclaw browser snapshot --interactive

# 点击元素
openclaw browser click @e1

# 输入文本
openclaw browser type @e2 &#34;搜索内容&#34; --submit

# 截图
openclaw browser screenshot --full-page

# 停止浏览器
openclaw browser stop
</code></pre><h2 id="定时任务-cron">定时任务 (Cron)</h2>
<pre tabindex="0"><code># 查看定时任务
openclaw cron list

# 添加定时任务（每 30 分钟）
openclaw cron add --name &#34;heartbeat&#34; --every 30m --system-event &#34;检查邮件&#34;

# 添加定时任务（特定时间）
openclaw cron add --name &#34;reminder&#34; --at &#34;2026-03-10T09:00:00Z&#34; --message &#34;开会提醒&#34;

# 添加 Cron 表达式任务
openclaw cron add --name &#34;daily&#34; --cron &#34;0 9 * * *&#34; --system-event &#34;每日简报&#34;

# 启用/禁用任务
openclaw cron enable &lt;id&gt;
openclaw cron disable &lt;id&gt;

# 删除任务
openclaw cron rm &lt;id&gt;

# 立即运行任务
openclaw cron run &lt;id&gt;
</code></pre><h2 id="节点管理移动设备">节点管理（移动设备）</h2>
<pre tabindex="0"><code># 列出已配对节点
openclaw nodes list

# 查看节点详情
openclaw nodes describe --node &lt;id&gt;

# 批准配对请求
openclaw nodes approve &lt;requestId&gt;

# 拍照（iOS/Android）
openclaw nodes camera snap --node &lt;id&gt; --facing back

# 录屏（iOS/Android）
openclaw nodes screen record --node &lt;id&gt; --duration 30s

# 获取位置
openclaw nodes location get --node &lt;id&gt;

# 发送通知（macOS）
openclaw nodes notify --node &lt;id&gt; --title &#34;提醒&#34; --body &#34;内容&#34;

# 在节点上运行命令
openclaw nodes run --node &lt;id&gt; ls -la
</code></pre><h2 id="内存搜索">内存搜索</h2>
<pre tabindex="0"><code># 查看内存索引状态
openclaw memory status

# 重新索引内存
openclaw memory index

# 搜索记忆
openclaw memory search &#34;OpenClaw 安装&#34;
</code></pre><hr>
<h1 id="工作区文件结构">工作区文件结构</h1>
<p>OpenClaw 在工作区使用以下文件组织配置和记忆：</p>
<pre tabindex="0"><code>~/.openclaw/
├── workspace/                    # 主工作区
│   ├── AGENTS.md                # 多代理工作流配置
│   ├── SOUL.md                  # AI 行为准则和个性
│   ├── TOOLS.md                 # 工具能力和使用模式
│   ├── MEMORY.md                # 长期记忆（仅主会话）
│   ├── TOOLS.md                 # 工具配置
│   ├── BOOTSTRAP.md             # 首次运行引导（可删除）
│   ├── HEARTBEAT.md             # 定时任务检查清单
│   ├── IDENTITY.md              # AI 身份信息
│   ├── USER.md                  # 用户信息
│   ├── .learnings/              # 学习记录
│   │   ├── LEARNINGS.md
│   │   ├── ERRORS.md
│   │   └── FEATURE_REQUESTS.md
│   └── memory/                  # 每日记忆文件
│       └── YYYY-MM-DD.md
├── config.json                  # 主配置文件
├── agents/                      # 代理配置
└── skills/                      # 已安装技能
</code></pre><hr>
<h1 id="推荐技能清单">推荐技能清单</h1>
<table>
  <thead>
      <tr>
          <th>技能名称</th>
          <th>功能描述</th>
          <th>安装命令</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>agent-browser</strong></td>
          <td>浏览器自动化（导航、点击、截图）</td>
          <td><code>npx clawhub install agent-browser</code></td>
      </tr>
      <tr>
          <td><strong>tavily-search</strong></td>
          <td>AI 优化搜索</td>
          <td><code>npx clawhub install tavily-search</code></td>
      </tr>
      <tr>
          <td><strong>summarize</strong></td>
          <td>内容总结（URL、PDF、视频）</td>
          <td><code>npx clawhub install summarize</code></td>
      </tr>
      <tr>
          <td><strong>self-improving-agent</strong></td>
          <td>自我改进和学习记录</td>
          <td><code>npx clawhub install self-improving-agent</code></td>
      </tr>
      <tr>
          <td><strong>find-skills</strong></td>
          <td>发现和安装技能</td>
          <td><code>npx clawhub install find-skills</code></td>
      </tr>
      <tr>
          <td><strong>sag</strong></td>
          <td>ElevenLabs 语音合成</td>
          <td><code>npx clawhub install sag</code></td>
      </tr>
      <tr>
          <td><strong>canvas</strong></td>
          <td>画布展示和 A2UI</td>
          <td><code>npx clawhub install canvas</code></td>
      </tr>
  </tbody>
</table>
<hr>
<h1 id="故障排除">故障排除</h1>
<h2 id="openclaw-命令未找到">openclaw 命令未找到</h2>
<p><strong>诊断：</strong></p>
<pre tabindex="0"><code>node -v
npm -v
npm prefix -g
echo &#34;$PATH&#34;
</code></pre><p><strong>修复（macOS/Linux）：</strong></p>
<p>将以下行添加到 <code>~/.zshrc</code> 或 <code>~/.bashrc</code>：</p>
<pre tabindex="0"><code>export PATH=&#34;$(npm prefix -g)/bin:$PATH&#34;
</code></pre><p><strong>Windows：</strong>
将 <code>npm prefix -g</code> 的输出添加到系统 PATH 环境变量。</p>
<h2 id="模型认证失败">模型认证失败</h2>
<pre tabindex="0"><code># 检查认证状态
openclaw models status --probe

# 重新添加认证
openclaw models auth add
</code></pre><h2 id="网关无法启动">网关无法启动</h2>
<pre tabindex="0"><code># 检查端口占用
openclaw gateway status --deep

# 强制重启
openclaw gateway restart --force

# 查看详细日志
openclaw logs --follow
</code></pre><hr>
<h1 id="进阶使用技巧">进阶使用技巧</h1>
<h2 id="1-多代理架构">1. 多代理架构</h2>
<p>创建隔离的代理用于不同任务：</p>
<pre tabindex="0"><code># 创建工作代理
openclaw agents add work-agent --workspace ~/work-agent
openclaw agents bind --agent work-agent --bind slack:work

# 创建个人代理
openclaw agents add personal-agent --workspace ~/personal-agent
openclaw agents bind --agent personal-agent --bind telegram:personal
</code></pre><h2 id="2-环境变量配置">2. 环境变量配置</h2>
<p>自定义运行时路径：</p>
<pre tabindex="0"><code>export OPENCLAW_HOME=&#34;$HOME/.openclaw-custom&#34;      # 主目录
export OPENCLAW_STATE_DIR=&#34;/var/openclaw&#34;          # 可变状态
export OPENCLAW_CONFIG_PATH=&#34;/etc/openclaw.json&#34;   # 配置文件
</code></pre><h2 id="3-开发模式">3. 开发模式</h2>
<pre tabindex="0"><code># 使用隔离的开发环境
openclaw --dev dashboard

# 使用自定义配置文件
openclaw --profile work dashboard
</code></pre><h2 id="4-acp-桥接ide-集成">4. ACP 桥接（IDE 集成）</h2>
<pre tabindex="0"><code># 启动 ACP 桥接，连接 IDE 到网关
openclaw acp
</code></pre><hr>
<h1 id="更新与卸载">更新与卸载</h1>
<h2 id="更新-openclaw">更新 OpenClaw</h2>
<pre tabindex="0"><code># 通过 npm
npm update -g openclaw

# 或通过安装脚本重新安装
curl -fsSL https://openclaw.ai/install.sh | bash
</code></pre><h2 id="重置配置">重置配置</h2>
<pre tabindex="0"><code># 重置配置（保留 CLI）
openclaw reset --scope config

# 完全重置（包括凭证和会话）
openclaw reset --scope full --yes
</code></pre><h2 id="完全卸载">完全卸载</h2>
<pre tabindex="0"><code># 卸载服务和数据（保留 CLI）
openclaw uninstall --all --yes

# 然后手动删除全局安装
npm uninstall -g openclaw
</code></pre><hr>
<h1 id="总结">总结</h1>
<p>OpenClaw 是一个功能丰富的 AI 助手平台，主要特点包括：</p>
<ul>
<li><strong>多种安装方式</strong>：安装脚本、npm、源码、Docker</li>
<li><strong>多代理支持</strong>：隔离的工作区和路由</li>
<li><strong>丰富的技能生态</strong>：浏览器自动化、搜索、语音等</li>
<li><strong>跨平台消息</strong>：WhatsApp、Telegram、Discord、Slack 等</li>
<li><strong>移动设备集成</strong>：iOS/Android 节点配对</li>
<li><strong>定时任务</strong>：Cron 表达式支持</li>
<li><strong>浏览器自动化</strong>：完整的网页操作能力</li>
</ul>
<p><strong>快速开始命令：</strong></p>
<pre tabindex="0"><code># 安装
curl -fsSL https://openclaw.ai/install.sh | bash

# 初始化
openclaw onboard --install-daemon

# 验证
openclaw doctor
openclaw status

# 打开控制面板
openclaw dashboard
</code></pre><hr>
<p><strong>参考链接：</strong></p>
<ul>
<li><a href="https://docs.openclaw.ai">OpenClaw 官方文档</a></li>
<li><a href="https://clawhub.com">ClawdHub 技能市场</a></li>
<li><a href="https://github.com/openclaw/openclaw">GitHub 仓库</a></li>
<li><a href="https://discord.gg/clawd">Discord 社区</a></li>
</ul>
<hr>
<p><em>本文基于 OpenClaw 官方文档编写，最后更新于 2026-03-06</em></p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
