Please enable Javascript to view the contents

OpenClaw 安装与配置

 ·  ☕ 2 分钟

1. 准备 Node 环境

  • 安装 nvm
1
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
  • 设置 nvm 环境变量

需要修改 Bash 的配置文件,添加以下内容:

1
2
3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
  • 安装 Node
1
nvm install 22 default

2. 安装 OpenClaw

  • 安装包
1
npm install -g openclaw@latest
  • 卸载
1
npm uninstall -g openclaw
  • 初始化配置
1
openclaw onboard

加上 --install-daemon 参数,重启之后,服务自动启动。openclaw onboard --force 会强制重新初始化配置。

  • 调整配置参数

修改 ~/.openclaw/openclaw.json 文件的以下参数:

1
2
3
4
5
6
{
...
            "contextWindow": 262144,
            "maxTokens": 65536
...
}

重启 gateway 服务配置生效。

1
openclaw gateway restart

3. 使用命令

  • 在终端中与 Bot 对话
1
openclaw tui
  • 在浏览器中与 Bot 对话
1
openclaw dashboard

4. gateway 管理

gateway 是 OpenClaw 的网关模块,主要是需要启动和停止。

  • 启动
1
openclaw gateway
  • 停止
1
openclaw gateway stop
  • 重启
1
openclaw gateway restart

5. plugins 管理

plugins 是 OpenClaw 的功能扩展模块,主要是需要安装和启用。

  • 查看已安装插件
1
openclaw plugins list
  • 安装插件
1
openclaw plugins install telegram
  • 启用插件
1
openclaw plugins enable telegram
  • 禁用插件
1
openclaw plugins disable telegram

6. skills 管理

skills 是 OpenClaw 的技能模块,主要是需要安装和启用。

  • 查看已安装技能
1
openclaw skills list
  • 检查技能是否正常
1
openclaw skills check
  • 查看技能信息
1
openclaw skills info weather

7. channel 管理

channel 是 OpenClaw 与外部 / 用户交互的通信方式,主要是需要开启和配置。

  • 添加 channel
1
openclaw channels add --channel telegram --token <token>

也可以不加参数,进入交互页面配置 channel 信息。

  • 查看 channel 列表
1
openclaw channels list
  • 查看 channel 连接状态
1
openclaw channels status
  • 登出 channel
1
openclaw channels logout  --channel telegram

8. agent 管理

agent 是 OpenClaw 的智能体模块,主要是需要创建和管理。通过 agent 子命令可以创建多个角色的智能体

  • 查看 agent
1
openclaw agents list
  • 创建 agent
1
openclaw agents add test
  • 修改 agent 信息
1
openclaw agents  set-identity --agent test --name test2

修改 name/theme/emoji/avatar 等

  • 删除 agent
1
openclaw agents delete test
  • 与 agent 对话
1
openclaw agent --agent main --message "hello"

9. 运维操作

  • 查看 OpenClaw 状态
1
openclaw status
  • 查看实时日志
1
openclaw logs --follow
  • 安装 daemon
1
openclaw daemon install
  • 卸载 daemon
1
openclaw daemon uninstall
  • 检查
1
openclaw doctor
  • 卸载全部服务
1
openclaw uninstall --all --yes --non-interactive

10. 异常处理

  • channel 对话异常
1
2
400 Invalid JSON payload received. Unknown name "patternProperties" at 'tools[0].function_declarations[3].parameters.properties[4].value': Cannot find field.
Invalid JSON payload received. Unknown name "additionalProperties" at 'tools[0].function_declarations[5].parameters.properties[20].value.properties[3].value.items': Cannot find field.

模型配置异常,需要更换模型。


微信公众号
作者
微信公众号