OpenClaw—制作离线安装包

官网地址

https://github.com/openclaw/openclaw

克隆openclaw源代码

git clone https://github.com/openclaw/openclaw.git
git checkout xxx

下载node并构造

克隆openclaw源代码并且安装依赖

git clone https://github.com/tloncorp/openclaw.git

#下载node安装文件到openclaw源码中
wget https://nodejs.org/dist/v22.22.1/node-v22.22.1-linux-x64.tar.xz
mkdir openclaw/node
tar xvf node-v22.22.1-linux-x64.tar.xz -C openclaw/node/ --strip-components=1

#安装pnpm
cd openclaw
#需要设置环境变量,否则会找不到node
export PATH=$PATH:/home/cloud/openclaw/openclaw/node/bin/
./node/bin/npm install --prefix ./node/ pnpm -g

#安装依赖,如果无法从github中下载相应的文件,需设置代理
pnpm install --registry=https://registry.npmmirror.com

#编译
./node/bin/npx pnpm build

运行

./node/bin/node openclaw.mjs setup
export OPENCLAW_GATEWAY_TOKEN=my-secret-token
./node/bin/node openclaw.mjs gateway --port 18789 --allow-unconfigured

创建启动脚本如下

#!/bin/bash

BASE_DIR=$(cd "$(dirname "$0")"; pwd)

echo "$BASE_DIR"

export PATH=$BASE_DIR/node/bin:$PATH

echo "Starting OpenClaw..."

#node scripts/run-node.mjs

if [ ! -d "$HOME/.openclaw" ]; then
  echo "~/.openclaw 不存在,执行 setup..."
  node openclaw.mjs setup
else
  echo "~/.openclaw 已存在,跳过 setup"
fi

# 运行原始命令
#exec node openclaw.mjs setup
export OPENCLAW_GATEWAY_TOKEN=my-secret-token
exec node openclaw.mjs gateway --port 18789 --allow-unconfigured

#交互性配置使用这个命令
node/bin/node openclaw.mjs onboard

其他局域网客户端访问

ssh -L 18789:localhost:18789 cloud@192.168.88.66

打开浏览器

http://localhost:18789/chat?session=main&token=my-secret-token

配置模型

./node/bin/node openclaw.mjs config set model.default deepseek-chat