openclaw安装教程

/ 邓工 / 4阅读 / 0评论 / 分类: 学习

第一步:安装Node.js,打开https://nodejs.org/zh-cn/download,获取新版去官网安装;

# 下载并安装 nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# 代替重启 shell
\. "$HOME/.nvm/nvm.sh"

# 下载并安装 Node.js:
nvm install 24

# 验证 Node.js 版本:
node -v # Should print "v24.14.0".

# 验证 npm 版本:
npm -v # Should print "11.9.0".

第二步:安装openclaw,打开https://openclaw.ai/  ,获取安装代码选择npm安装,记住你的token

# Install OpenClaw
npm i -g openclaw
# Meet your lobster
openclaw onboard
 
第三步:安装tmux,
apt update
apt install -y tmux
tmux kill-session -t openclaw 2>/dev/null
tmux new -s openclaw -d 'openclaw gateway --port 18789 --force'
ss -lntp | grep 18789
curl -I http://127.0.0.1:18789/
第四步:访问前端出现“”origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins),这是 Origin 白名单没匹配上。直接一次性修好并重启网关:
openclaw config set gateway.controlUi.allowedOrigins '["https://ai.hzpm.com","http://ai.hzpm.com","https://chat.hzpm.com","http://chat.hzpm.com"]' --strict-json
openclaw config set gateway.trustedProxies '["127.0.0.1","::1"]' --strict-json
tmux kill-session -t openclaw 2>/dev/null
tmux new -s openclaw -d 'openclaw gateway --port 18789 --force'

确认生效:

openclaw config get gateway.controlUi.allowedOrigins curl -I http://127.0.0.1:18789/

然后用无痕窗口打开:

https://XXX.com/#token=当前token 或者https://XXX.com/?token=当前token

 

你自定义的token(如果需要)

openclaw config set gateway.auth.mode token
openclaw config set gateway.auth.token "你自定义的token"
tmux kill-session -t openclaw 2>/dev/null
tmux new -s openclaw -d 'openclaw gateway --port 18789 --force'

pairing required 这是正常的,说明 token 和 origin 已经过了,现在只差设备配对授权。

执行:

openclaw devices list

找到当前浏览器对应的 pending requestId,然后批准:

openclaw devices approve <requestId>

如果只有一条待审批,也可直接:

openclaw devices approve --latest

批准后刷新 https://XXX.com/#token=你的token 即可。


扫描二维码,在手机上阅读
« 没有了
发表评论