linux下安装openclaw

安装 OpenClaw

使用官方国内镜像一键安装脚本:

curl -fsSL https://open-claw.org.cn/install-cn.sh | bash

安装完成后,通过 npm 全局安装:

sudo npm install -g openclaw

验证安装:

openclaw --version
# 输出:OpenClaw 2026.6.10 (aa69b12)

上一篇博客配置了本地的qwen3.6B moe模型。

我们得把qweb3.6-35B的moe模型配置到openclaw里面
运行 OpenClaw 配置向导

openclaw configure

配置开始开始。
~/Codes$ openclaw configure

我按照这个流程配置下来的。

OpenClaw 2026.6.10 (aa69b12) — The only open-source project where the mascot could eat the competition.

┌  OpenClaw configure
│
◇  Where will the Gateway run?
│  Local (this machine)
│
◇  What do you want to configure?
│  Model
│
◇  Model/auth provider
│  More…
│
◇  Model/auth provider
│  Custom Provider
│
◇  API Base URL
│  http://127.0.0.1:8080/v1
│
◇  How do you want to provide this API key?
│  Paste API key now
│
◇  API Key (leave blank if not required)
│  
│
◇  Endpoint compatibility
│  OpenAI-compatible
│
◇  Model ID
│  qwen3.6-35b
│
◇  Verification successful.
│
◇  Endpoint ID
│  custom-127-0-0-1-8080
│
◇  Model alias (optional)
│  local
Configured custom provider: custom-127-0-0-1-8080/qwen3.6-35b
Updated config: ~/.openclaw/openclaw.json
│
◆  What do you want to configure?
│  ● Workspace (Set workspace + sessions)
│  ○ Model
│  ○ Web tools
│  ○ Gateway
│  ○ Daemon
│  ○ Channels
│  ○ Plugins
│  ○ Skills
│  ○ Health check
│  ○ Done
选择Done,完成基础配置

安装QQBot 插件

确认 npm 镜像源配置

npm config get registry

如果显示的不是 https://registry.npmmirror.com ,执行:

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

或者直接使用

sudo npm install -g @sliverp/qqbot@latest --registry=https://registry.npmmirror.com

因为我接入的是QQ机器人
打开QQ开放平台,登录自己的QQ然后记录AppID和AppSecret

https://q.qq.com/#/apps

再linux 下执行安装qqbot插件

openclaw plugins install @sliverp/qqbot@latest

配置你的AppID和AppSecret

openclaw channels add --channel qqbot --token "你的AppID:你的AppSecret"

提示这个之后:
Installed QQ Bot plugin
Added QQ Bot account "default".
就是成功了。

最后一步:启动并验证

启动网关服务(使配置生效)

openclaw gateway install

检查服务状态

openclaw status

安装为系统服务(后台运行)

openclaw gateway install

你在QQ上发消息。应该就可以收到了。

检查openclaw的上下文长度设置。

我们在llama.cpp里面是262K.这里也保持一样。我们可以在检查一下。
查看配置文件路径

openclaw config file
# 输出示例:~/.openclaw/openclaw.json

这会输出配置文件的实际路径,通常为 ~/.openclaw/openclaw.json。
打开它

cat ~/.openclaw/openclaw.json   //打开它
//找到这一段
 "models": [
          {
            "id": "qwen3.6-35b",
            "name": "qwen3.6-35b (Custom Provider)",
            "contextWindow": 128000,
            "maxTokens": 4096,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "reasoning": false
          }
        ]

确保与 llama-server 配置对齐。找到上一篇博客里面的start_llama_server_daemon.sh。读取一下。写入到这里。

 //我的llama的-c 参数是262144

- `contextWindow`:模型能接收的最大输入长度(包括历史对话和当前提问)。在 OpenClaw 中应与 `llama-server` 的 `-c` 参数保持一致。
- `maxTokens`:模型单次生成的最大输出长度。不能等于 `contextWindow`,因为输入也需要占用上下文空间。

推荐配置:
- `contextWindow` = 262144
- `maxTokens` = 8192(可根据任务调整)

实际执行流程
OpenClaw 收到一条用户消息(例如 1000 tokens)
加上历史对话(假设 5000 tokens)
总输入长度 = 6000 tokens
OpenClaw 将 max_tokens(例如 8192)传给 llama-server
llama-server 检查:输入长度(6000) + 输出长度(8192) = 14192 ≤ 262144 ✅
推理完成后,模型返回 8192 tokens 的输出

重启 OpenClaw 网关

openclaw gateway restart

我喜欢使用命令行对话的方式

openclaw chat    
//整体就结束拉。就可以工作了。这里忘记配置联网检索了。

联网检索

//执行这个命令按照选项选择就可以了。我使用的是免费的。
openclaw configure --section web

Web search ────────────────────────────────────────────────────────────────────────────╮
│                                                                                         │
│  Web search lets your agent look things up online using the `web_search` tool.          │
│  Choose a managed provider now, and Codex-capable models can also use native Codex web  │
│  search.                                                                                │
│  Docs: https://docs.openclaw.ai/tools/web                                               │
│                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Enable web_search?
│  Yes
│
◇  Web search ─────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Web search lets your agent look things up online.                           │
│  Choose a provider. Some providers need an API key, and some work key-free.  │
│  Docs: https://docs.openclaw.ai/tools/web                                    │
│                                                                              │
├──────────────────────────────────────────────────────────────────────────────╯
│
◇  Search provider
│  Parallel Search (Free)
│
◇  Web search ──────────────────────────────────────────────────────────────╮
│                                                                           │
│  Parallel Search (Free) works without an API key.                         │
│  OpenClaw will enable the plugin and use it as your web_search provider.  │
│  Docs: https://docs.openclaw.ai/tools/parallel-search                     │
│                                                                           │
├───────────────────────────────────────────────────────────────────────────╯
│
◇  Install Parallel plugin?
│  Download from npm (@openclaw/parallel-plugin)
│
◇  Installed Parallel plugin
│
◇  Enable web_fetch (keyless HTTP fetch)?
│  Yes
Updated config: ~/.openclaw/openclaw.json
  Backup: ~/.openclaw/openclaw.json.bak
│
└  Configuration updated.



最后执行一次重启,然后打开chat模式

openclaw gateway restart
//打开chat
openclaw chat

不要把服务直接暴露到公网:除非你完全了解风险并有额外的安全措施(如 HTTPS、防火墙等),否则永远不要将 18789 端口直接暴露到公共互联网。

保护好你的密码:你设置的网关密码是最高权限凭证,请务必妥善保管,不要泄露
更安全的进阶方案:使用 Tailscale
如果你的 Windows 电脑和 Linux 服务器不在同一个局域网,或者你希望获得更高级别的安全保障,可以考虑使用 Tailscale 创建一个虚拟的私有网络。这样,你的“龙虾”服务只会在你自己的私有网络中可见,安全性更高。

posted @ 2026-06-27 10:01  杜文龙  阅读(36)  评论(1)    收藏  举报