由于OpenClaw的安全性问题,考虑了这样几个措施:
- 买了个阿里云服务,不至于把自己机器破坏了
- 服务器也是多用途的,所以里面加一层Docker给OpenClaw用
- 最后打算再给OpenClaw套一个User Mode,而非root
以下是基本步骤
#启动一个npm基础镜像的容器,背景运行 docker run -d –name npmclaw node:22-bookworm sleep infinity #登入 docker exec -it npmclaw bash
1. 设置淘宝镜像为默认源(国内最快、最稳定)
npm config set registry https://registry.npmmirror.com
2. 验证是否切换成功(输出上述地址即生效)
npm config get registry
#运行npm i -g openclaw,其他的option是增加安装进展的观测 npm i -g openclaw –registry=https://registry.npmmirror.com –progress=true –verbose
#配置 openclaw onboard
准备好api,我用的是兼容openai的阿里云coding-plan,所以选customized
大模型服务平台百炼控制台
输入访问API https://coding.dashscope.aliyuncs.com/v1 以及key,很顺利通过验证
参考这个文章
https://www.volcengine.com/docs/6396⁄?lang=zh#UYMAmabS
在飞书开发者后台创建机器人,开发者后台 - 飞书开放平台
按openclaw配置输入secret和id,group权限选择open就好
◇ Feishu credentials ──────────────────────────────────────────────────────────────╮ │ │ │ 1) Go to Feishu Open Platform (open.feishu.cn) │ │ 2) Create a self-built app │ │ 3) Get App ID and App Secret from Credentials page │ │ 4) Enable required permissions: im:message, im:chat, contact:user.base:readonly │ │ 5) Publish the app or add it to a test group │ │ Tip: you can also set FEISHU_APP_ID / FEISHU_APP_SECRET env vars. │ │ Docs: feishu │ │ │ ├───────────────────────────────────────────────────────────────────────────────────╯
openclaw gateway
docker update –restart unless-stopped clawdocker
sudo vi /etc/systemd/system/clawdocker-gateway.service
[Unit] Description=Clawdocker Gateway
确保Docker服务先启动
After=docker.service containerd.service Requires=docker.service
[Service]
服务类型:只执行一次就完成
Type=oneshot
核心逻辑:循环检查容器是否运行,运行后执行exec命令
允许服务执行完成后仍标记为active
RemainAfterExit=yes
可选:如果需要非root用户执行,取消注释并替换用户名
User=your-username
Group=your-username
[Install]
绑定到多用户运行级别(开机启动)
WantedBy=multi-user.target
# 重新加载systemd配置(修改服务文件后必须执行) sudo systemctl daemon-reload
设置服务开机自启
sudo systemctl enable container-exec.service
手动测试服务(验证是否正常执行,无需重启系统)
sudo systemctl start container-exec.service
查看服务状态(确认无错误)
sudo systemctl status container-exec.service
在飞书上找到My OpenClaw Bot说句话,然后就可以看到要做pair认证,到命令行上输入下面命令就好
openclaw pairing approve feishu J43CZWWY –notify
另外,可以也可以再开一个命令行用tui聊天
openclaw tui
打开clawhub,用github登入,获取token
clawhub login –no-browser –token
<贴上token>贴上token>
✔ OK. Logged in as <@user>
作为web_search的brave search api的替代,安装multi-search-engine
参考:
老板娘吐槽 Brave API key 未配置?我把 OpenClaw 原生 Tools 全捋了一遍
你的OpenClaw为何一问三不知?
clawhub install multi-search-engine
multi-search-engine在npm版本上未能有效激活,改为百炼mcp WebSearch
准备工作:
- 操作步骤和工作guide,开提供mcp。 添加联网搜索MCP
- 2. 开通百炼WebSearch MCP。 大模型服务平台百炼控制台
- 3. 添加api key。注意,有两种api key
- 一种是百炼通用的api key(与Coding Plan的api key不同,有2000次试用/月)sk-…。获取API Key
- 另一种是Coding Plan的套餐api和链接,不能用在这里 sk-sp-…。大模型服务平台百炼控制台
# mcporter安装 npm install -g mcporter
设置enable
openclaw config set skills.entries.mcporter.enabled true
到工作目录
cd ~/.openclaw/workspace
添加百炼mcp key
mcporter config add WebSearch https://dashscope.aliyuncs.com/api/v1/mcps/WebSearch/mcp –transport http –header “Authorization=Bearer YOUR_API_KEY”
验证
mcporter list
重启
openclaw gateway restart
在docker中
docker restart npmclaw docker exec -d npmclaw openclaw gateway
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/228947.html