搭建
官网安装教程
1
2
3
4
5
| curl -fsSL https://openclaw.ai/install.sh | bash
# 跳过新手引导直接安装 no onborad
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
npm install -g openclaw@latest
|
我在一个阿里云的2vCPU2GB的服务器上执行官方指令总是不行(2GB内存实在是太小了),但是用阿里云的一个部署案例中的安装脚本就可以
1
| curl -fsSL https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260225/azxgob/openclaw_installer.sh -o openclaw_installer.sh && bash openclaw_installer.sh
|
配置:
阿里云的coding plan 接入 OpenClaw
默认的配置路径: /root/.openclaw/openclaw.json
常用配置和解释
1
2
3
4
| # 默认情况下,允许把心跳消息发送给私聊(DM)形式的用户目标,关闭私聊心跳(但保留心跳功能)
agents.defaults.heartbeat.directPolicy: "block"
# 关闭心跳
agents.defaults.heartbeat.every: "0m"
|
转发 dashboard
1
2
3
4
5
| ssh -N -L 18789:127.0.0.1:18789 Aliyun
# 后台持续启动 和 关闭
ssh -fN -L 18789:127.0.0.1:18789
pkill -f "ssh -fN -L 18789"
|
常用指令
你需要一份 OpenClaw 的常用指令总结,方便日常使用和配置,我会按「核心操作、配置管理、服务控制、进阶操作」分类整理,让你一目了然。
OpenClaw 常用指令全总结
OpenClaw 的指令核心是通过 openclaw 命令行工具执行,以下是高频使用的指令,适配 macOS/Linux/Windows(Windows 需在 PowerShell 中执行)。
一、核心基础操作
| 指令 | 作用 | 示例 |
|---|
openclaw -v / openclaw version | 查看 OpenClaw 版本(验证安装) | openclaw -v |
openclaw help | 查看所有指令的帮助文档 | openclaw help config(查看 config 子命令帮助) |
openclaw start | 启动 OpenClaw 网关服务(默认前台运行) | openclaw start |
openclaw start -d | 后台启动网关(守护进程模式) | openclaw start -d |
openclaw stop | 停止后台运行的 OpenClaw 服务 | openclaw stop |
openclaw restart | 重启网关服务(配置修改后常用) | openclaw restart |
二、配置管理(最常用)
| 指令 | 作用 | 示例 |
|---|
openclaw config list | 列出所有当前配置项(含默认值) | openclaw config list |
openclaw config get <key> | 查询单个配置项的值 | openclaw config get memory.backend |
openclaw config set <key> <value> | 设置配置项(核心) | openclaw config set model.catalog.mode merge
openclaw config set api.port 8080 |
openclaw config unset <key> | 重置配置项为默认值 | openclaw config unset model.catalog.mode |
openclaw config edit | 直接编辑配置文件(适合批量修改) | openclaw config edit(会打开系统默认编辑器) |
三、模型与服务商管理
| 指令 | 作用 | 示例 |
|---|
openclaw provider list | 列出已配置的 AI 服务商(OpenAI/智谱/Anthropic 等) | openclaw provider list |
openclaw provider add <name> | 添加自定义服务商(如智谱 Coding API) | openclaw provider add zhipu-coding (按提示输入 API 地址/Key/模型名) |
openclaw provider remove <name> | 删除指定服务商 | openclaw provider remove zhipu-coding |
openclaw model list | 列出所有可用模型(含内置+自定义) | openclaw model list |
四、进阶操作
| 指令 | 作用 | 适用场景 |
|---|
openclaw logs | 查看网关运行日志(调试排错) | 服务启动失败、API 调用报错时 |
openclaw health | 检查网关健康状态(端口/依赖/配置) | 验证服务是否正常运行 |
openclaw update | 升级 OpenClaw 到最新版本 | 体验新功能/修复 bug |
openclaw clean | 清理缓存(日志/模型索引/临时文件) | 磁盘占用过高、索引异常时 |
总结
- 核心启停:
openclaw start/stop/restart 是日常控制服务的基础,后台运行加 -d; - 配置核心:
openclaw config set/get/list 是自定义 OpenClaw 的关键,比如设置模型目录模式、API 端口; - 服务商配置:
openclaw provider add/remove 用于添加智谱 Coding API 等自定义服务商,适配你之前提到的不同 URL; - 排错辅助:
openclaw logs/health 能快速定位服务启动或调用的问题。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| # 方式一:停止服务后,再启动服务
openclaw gateway stop
# 等待 2-3 秒后启动服务
openclaw gateway start
# 方式二:直接使用重启命令
openclaw gateway restart
openclaw models list
systemctl --user daemon-reload
systemctl --user restart openclaw-gateway.service
|
安装技能 Skills
官方技能仓库:Clawhub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # 安装 clawhub
npm i -g clawhub
pnpm add -g clawhub
# clawhub 用法
## Install a skill into your workspace:
clawhub install <skill-slug>
## Update all installed skills:
clawhub update --all
## Sync (scan + publish updates):
clawhub sync --all
# 使用最新的clawhub
npx clawhub@latest install <skill-slug>
|
1
2
3
4
5
6
7
8
| # 生成新令牌(GitHub网站操作)
# 1. 访问 https://github.com/settings/tokens
# 2. 选择 fine-grained tokens 或 classic tokens
# 3. 设置权限范围:至少包含 repo, read:packages
# 在OpenClaw配置中启用令牌
echo 'export GITHUB_TOKEN="ghp_your_token_here"' >> ~/.bashrc
source ~/.bashrc
|
openclaw skills 不支持 子命令 install。
在 OpenClaw 中,openclaw skills 只提供这些子命令:
1
2
3
4
5
6
| # 列出所有可用的 skills
openclaw skills list
# 查看某个 skill 的详细信息
openclaw skills info <name>
# 检查哪些 skills 就绪、哪些缺少依赖
openclaw skills check
|
推荐 Skills
🔥 核心必装(所有设备通用)
- @openclaw/standard-skills - 标准基础能力(指令解析、调度)
- @openclaw/system-skills - 执行命令、通知、进程管理
- @openclaw/file-skills - 文件读写、复制、删除、搜索
- @openclaw/network-skills - 网络检测、端口扫描、请求
📱 Android / 手机专用
- @openclaw/canvas-skills - 截图、屏幕控制、图像识别
- @openclaw/camera-skills - 相机拍照、录像
💻 电脑 / 服务器专用
- @openclaw/automation-skills - 桌面自动化
- @openclaw/shell-skills - 高级终端命令执行
🔐 运维 / 效率专用
- @openclaw/schedule-skills - 定时任务
- @openclaw/notify-skills - 消息推送(微信/钉钉/邮件)
可扩展方向
- 和米家生态联动!
- [[安卓设备作为节点加入OpenClaw]]
Comments