OpenClaw本地部署&使用

0 阅读6分钟

介绍

OpenCalw,小龙虾,你的 AI 助手,部署在本地,可以全面接管你的电脑,你只需要对他下发指令,它会处理

还可接入大量开发者制作的 skills,使其具备某种专项能力,非常酷

本文介绍如何在本地(windows)部署 OpenClaw

Github 地址:github.com/openclaw/op…

部署

使用 NodeJs 部署,要求 24+ 版本,可参考下面这篇博客使用 nvm 安装,或者直接下载 NodeJs 安装

NodeJs 环境有了,敲下面的命令验证,并且设置一个淘宝镜像,方便后面下载

npm config set registry https://registry.npmmirror.com --global

如下,记得要用管理员打开命令窗口,参考下面这篇博客

在这里插入图片描述

接着敲下面的命令,安装 OpenClaw

npm i -g openclaw

wait moment...

在这里插入图片描述

done. 还是花了不少时间

在这里插入图片描述

查看一下版本号,前天的版本,项目还是太火了

在这里插入图片描述

启动

敲下面的命令,启动 openclaw,完成初始化

openclaw onboard

YES,敲回车

在这里插入图片描述

敲回车,QuickStart(快速开始)

在这里插入图片描述

我这台电脑之前装过,读到旧配置了,我这里选 Reset(重置),敲回车

在这里插入图片描述

Full reset(全部重置),敲回车

在这里插入图片描述

选大模型的供应商,大家根据自己的需要选一个

在这里插入图片描述

我这里选择 Z.AI(智谱),敲回车,这里选择授权提供的方式,我选择 API Key 的方式,敲回车

在这里插入图片描述

把在智谱上创建的 API Key 贴到这里,敲回车

在这里插入图片描述

这里设置默认使用的模型(默认它会选择大模型提供商最新的模型),但是 GLM-5.1 我没套餐,我这里选择 GLM-4.7,敲回车

在这里插入图片描述

频道接入方式(使用方式,能通过手机上的应用控制),这里选择 Skip for now(跳过),敲回车

在这里插入图片描述

搜索引擎,选 Skip for now(跳过),敲回车

在这里插入图片描述

要不要配置 skills,暂时先不配置,它一开始会加载一些初始的 skill,有 50 来个,点 No,敲回车

在这里插入图片描述

要不要开启钩子,暂时先不设置,按空格选中 Skip for now,敲回车

在这里插入图片描述

之前装过 openclaw 的网关,提示是否要重启,还是重装,我这里点重装 Reinstall,敲回车

在这里插入图片描述

出现下面这个界面,表示初始化操作完成了

在这里插入图片描述

接着会另外弹出一个命令窗口,这是 openclaw 的应用进程窗口

在这里插入图片描述

浏览器访问:http://127.0.0.1:18789,进入 openclaw 的控制台

在这里插入图片描述

首次登录,需要 token,token 就在上面初始化完成的这里,把它粘贴过去就能完成登录

在这里插入图片描述

使用

使用起来很容易,就是聊天,把你的需求告诉它

在这里插入图片描述

比如问一下,我的桌面上有什么文件,帮我总结一下

还行,就是有点慢

在这里插入图片描述

上点难度,回答的还行,就是慢

在这里插入图片描述

Skill

上 skill,给它装两个 SSH 相关的 skill,让他连接我的本地服务器,尝试做一些操作

默认加载了 52 个 skills

在这里插入图片描述

访问 skill 仓库(clawhub.ai/),找两个 SSH 相关的 skill

把排在前面的三个 skill 都下载下来

在这里插入图片描述

如下

在这里插入图片描述

创建三个文件夹,分别解压,放到 openclaw 存放 skill 的目录里

在这里插入图片描述

如何找这个目录,可以敲下面的命令,找 openclaw 命令在哪里,就能找到 skill 所在的目录

where openclaw

如下

在这里插入图片描述

放进来后不用重启 openclaw,它自己就能加载进来,这回 skill 有 55 个了,加了 3 个

在这里插入图片描述

测试一下,让它使用账号密码连接本地虚拟机部署的服务器,关闭 Jenkins 服务

在这里插入图片描述

执行完了

在这里插入图片描述

敲命令看下,哟,真给关了,还真行

在这里插入图片描述

命令

豆包总结的 openclaw 的命令列表如下:

【基础全局命令】
openclaw --version          # 查看版本
openclaw --help             # 查看所有命令帮助
openclaw --help <command>   # 查看指定命令详情(如 openclaw --help gateway)
openclaw update             # 一键更新到最新版
openclaw tui                # 启动终端图形界面(新手友好)
openclaw dashboard          # 打开Web控制面板(http://localhost:18789)
openclaw dashboard --no-open # 仅启动面板,不自动打开浏览器

【初始化与配置(Setup/Config)】
openclaw onboard            # 一键初始化向导(首次安装必用)
openclaw setup --wizard     # 交互式配置向导
openclaw configure          # 进入交互式配置
openclaw config get <key>   # 查看配置项(如 openclaw config get gateway.port)
openclaw config set <key> <value> # 设置配置项
openclaw config unset <key> # 删除配置项
openclaw config file        # 打开配置文件目录
openclaw security audit --fix # 安全审计并修复

【Gateway 网关服务(核心)】
# 前台运行(调试用)
openclaw gateway           # 前台启动(别名:openclaw gateway run)
openclaw gateway --port 8080 # 指定端口启动
openclaw gateway --allow-unconfigured # 跳过配置检查强制启动

【服务管理(后台/开机自启)】
openclaw gateway install    # 安装为系统服务(Windows计划任务/Linux systemd)
openclaw gateway start      # 启动服务
openclaw gateway stop       # 停止服务
openclaw gateway restart    # 重启服务
openclaw gateway uninstall  # 卸载服务

【状态检查】
openclaw gateway status     # 查看网关状态
openclaw gateway status --deep # 深度诊断(含系统服务扫描)
openclaw gateway status --json # JSON格式输出

【状态、健康与日志】
openclaw status             # 基础状态检查
openclaw status --deep      # 深度全系统诊断
openclaw status --usage     # 查看API配额/用量
openclaw health             # 网关健康检查
openclaw doctor             # 自动诊断+修复常见问题
openclaw logs               # 查看最近日志
openclaw logs --follow      # 实时跟踪日志(tail -f)
openclaw logs --limit 200   # 查看最后200行
openclaw logs --json        # JSON格式日志
openclaw secrets reload     # 重载密钥/证书

【模型管理(Models)】
openclaw models status      # 模型状态
openclaw models list        # 列出可用模型
openclaw models list --all  # 所有模型(含未启用)
openclaw models list --local # 本地模型
openclaw models list --provider anthropic # 按厂商过滤
openclaw models set <model> # 设置默认主模型(如 claude-3-5-sonnet)

【渠道与连接(Channels)】
openclaw channels list      # 列出所有渠道(微信、TG、Discord等)
openclaw channels status    # 渠道状态
openclaw channels status --probe # 连通性探测
openclaw channels logs      # 渠道专属日志
openclaw channels logout <name> # 登出渠道

【设备与节点(Devices/Nodes)】
openclaw devices list        # 已配对设备
openclaw devices pending    # 待批准设备
openclaw devices approve <id> # 批准设备
openclaw devices reject <id> # 拒绝设备
openclaw devices remove <id> # 删除设备

【会话与聊天(Sessions)】
openclaw sessions           # 最近会话
openclaw sessions --active 120 # 2小时内活跃会话
openclaw sessions --all     # 所有历史会话
openclaw sessions --json    # JSON输出
openclaw sessions delete <id> # 删除会话

【插件 / 技能(Plugins/Skills)】
openclaw plugins list       # 插件列表
openclaw plugins install <name> # 安装插件
openclaw plugins update --all # 更新所有插件
openclaw plugins enable <name> # 启用
openclaw plugins disable <name> # 禁用
openclaw skills list        # 技能列表

【常用速查(高频)】
# 启动/服务
openclaw gateway install    # 安装服务
openclaw gateway start      # 启动
openclaw gateway status     # 状态

# 调试
openclaw doctor             # 一键修复
openclaw logs --follow      # 看日志
openclaw dashboard          # 开面板

# 配置
openclaw config set gateway.port 18789
openclaw models set claude-3-5-sonnet