在 Ubuntu 上部署 OpenClaw 完整教程
本文记录在 Ubuntu 22.04 服务器上从零部署 OpenClaw 并接入飞书的完整过程,包括遇到的坑和解决方法。
环境信息
- 系统: Ubuntu 22.04 LTS
- 配置: 4 核 8GB 内存,100M 带宽
- 类型 CPU
一、安装依赖
1.1 更新系统包索引
sudo apt update
1.2 安装 curl
sudo apt install -y curl
1.3 通过 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 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
完整安装日志:
ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ curl -fsSL https://openclaw.ai/install.sh | bash
🦞 OpenClaw Installer
The only crab in your contacts you actually want to hear from.
🦞 ✓ Detected: linux
Install plan OS: linux Install method: npm Requested version: latest
[1/3] Preparing environment
✓ Node.js v24.14.0 found · Active Node.js: v24.14.0 (/usr/bin/node)
· Active npm: 11.9.0 (/usr/bin/npm)
[2/3] Installing OpenClaw
✓ Git already installed · Configuring npm for user-local installs
✓ npm configured for user installs · Installing OpenClaw v2026.2.26
✓ OpenClaw npm package installed ✓ OpenClaw installed
[3/3] Finalizing setup
!PATH missing npm global bin dir: /home/ubuntu/.npm-global/bin
This can make openclaw show as "command not found" in new terminals.
Fix (zsh: ~/.zshrc, bash: ~/.bashrc): export PATH="/home/ubuntu/.npm-global/bin:$PATH"
🦞 OpenClaw installed successfully (2026.2.26)! All done!
I promise to only judge your code a little bit.
· Starting setup
🦞 OpenClaw 2026.2.26 (bc50708) — Ship fast, log faster.
...
◇ Gateway port: 18789
◇ Gateway bind: Loopback (127.0.0.1)
◇ Model configured ───────────────╮
│ │ Default model set to zai/glm-5 │
│ ├──────────────────────────────────╯
◇ Channel status ────────────────────────────
│ Feishu: install plugin to enable
...
◇ Dashboard ready ────────────────────────────────────────────────────────────────
│ Dashboard link(with token):
│ http://127.0.0.1:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183
│ Copy/paste this URL in a browser on this machine to control OpenClaw.
│ No GUI detected. Open from your computer:
│ ssh -NL 18789:127.0.0.1:18789 [email protected]
│ Then open:
│ http://localhost:18789/
│ http://localhost:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183
└ Onboarding complete. Use the dashboard link above to control OpenClaw.


