Ubuntu 部署 OpenClaw 完整指南
本文记录在 Ubuntu 22.04 服务器上从零部署 OpenClaw 并接入飞书的完整过程,包含环境配置、依赖安装及常见问题处理。
环境信息
- 系统: Ubuntu 22.04 LTS
- 配置: 4 核 8GB 内存,100M 带宽
- 类型: CPU
一、安装依赖
1.1 更新系统包索引
首先确保系统包列表是最新的:
sudo apt update
1.2 安装 curl
OpenClaw 的安装脚本依赖 curl,请确保已安装:
sudo apt install -y curl
1.3 通过 NodeSource 安装 Node.js LTS 版本
使用 NodeSource 仓库安装最新稳定版(LTS):
# 添加 NodeSource 仓库并安装
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
# 验证版本
node -v
npm -v
实际输出示例:
ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ node -v
v24.14.0
ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ npm -v
11.9.0
1.4 设置淘宝镜像
国内环境下建议配置 npm 镜像以加速下载:
npm config set registry https://registry.npmmirror.com
npm config get registry
验证输出:
ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ npm config get registry
https://registry.npmmirror.com
二、安装 OpenClaw
执行官方安装脚本。注意:安装过程中若提示确认,请输入 yes。
curl -fsSL https://openclaw.ai/install.sh | bash
关键日志说明:
安装完成后,脚本会提示 PATH 环境变量可能缺失,这是常见情况,后续会有专门步骤修复。同时会生成 Dashboard 访问链接和 Token,请务必保存。
🦞 OpenClaw installed successfully (2026.2.26)! All done!
...
◇ Gateway service runtime ────────────────────────────────────────────
│ QuickStart uses Node for the Gateway service(stable + supported).
...
◇ Control UI ─────────────────────────────────────────────────────────────────────╮
│ │ Web UI: http://127.0.0.1:18789/ │
│ │ Web UI (with token): │
│ │ http://127.0.0.1:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183 │


