openclaw安装教程
第一步:安装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。
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/
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 即可。
