在 Termux 的 Ubuntu 里执行
OpenClaw + Codex CLI 安装说明
这个页面只管 Ubuntu 内 的安装。它会安装 Node.js 24、OpenClaw、Codex CLI,并写好本地配置文件。
不在 Termux 原生环境跑。你必须先完成 Ubuntu 安装,并确认自己已经进入 Ubuntu 之后再执行这里的命令。
一键安装命令
curl -fsSL https://u.quanxin.edu.kg/ubuntu-openclaw-codex-install.sh | bash
执行时会提示你输入 Base URL 和 API Key,本地写入配置。
安装完成后怎么用
- 启动 OpenClaw:
bash ~/start-openclaw-gateway.sh - 查看状态:
bash ~/openclaw-status.sh - 停止 OpenClaw:
bash ~/stop-openclaw-gateway.sh - 启动 Codex:
codex
脚本会写哪些文件
~/.codex/config.toml(写入你输入的 Base URL)~/.codex/auth.json(写入你输入的 API Key)~/.openclaw/openclaw.json(写入你输入的 Base URL / API Key,默认已写入discovery.mdns.mode = off)~/start-openclaw-gateway.sh~/stop-openclaw-gateway.sh~/openclaw-status.sh
只负责安装和写配置文件,不会帮你配置 TG / Telegram / 频道联动。
后续想更换 Base URL / API Key
如果你以后想换中转站地址,或者想换新的 API Key,不需要重装。直接运行下面这个脚本即可:
curl -fsSL https://u.quanxin.edu.kg/update-openclaw-codex-config.sh | bash
脚本会提示你输入新的 Base URL 和 API Key;有哪个配置就改哪个,两个都有就两个都改。
常见错误排查
1. 报 -E: command not found
这是旧版脚本在 root 场景下的 bug。现在已经修复,重新执行最新安装命令即可:
curl -fsSL https://u.quanxin.edu.kg/ubuntu-openclaw-codex-install.sh | bash
2. 报 Connection failed / Unable to fetch some archives
脚本现在已经自动切到 HTTPS 镜像、开启重试、并会先做 apt 自恢复。一般直接重跑即可:
curl -fsSL https://u.quanxin.edu.kg/ubuntu-openclaw-codex-install.sh | bash
3. 报 Gateway service disabled / systemd user services unavailable
说明你本地还是旧的启动脚本。执行下面这个补丁修复:
curl -fsSL https://u.quanxin.edu.kg/fix-openclaw-launcher.sh | bash
这个补丁只修复 start/stop/status 三个脚本,不会重装 OpenClaw。
4. 日志里出现 uv_interface_addresses / error 13 / Bonjour / mDNS
这通常是当前环境不支持 Bonjour/mDNS 接口枚举导致的。最新版安装器已经默认把 discovery.mdns.mode 设为 off。如果你是旧配置,就先运行修复补丁,再重新启动 Gateway。
5. 想确认 Gateway 是否真的起来了
直接运行:
bash ~/openclaw-status.sh
它会显示 PID、监听端口 18789,以及最近日志。