在 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
关键安装日志:
🦞 OpenClaw Installer
...
✓ OpenClaw installed [3/3] Finalizing setup
! PATH missing npm global bin dir: /home/ubuntu/.npm-global/bin
Fix (zsh: ~/.zshrc, bash: ~/.bashrc): export PATH="/home/ubuntu/.npm-global/bin:$PATH"
🦞 OpenClaw installed successfully (2026.2.26)! All !
...
◇ Dashboard ready ────────────────────────────────────────────────────────────────╮
│ │ Dashboard (with token): http://127.0.0.1:18789/#token=...
└───────────────────────────────────────────────────────────────────────────────────╯


