Ubuntu 部署 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 user installs
· Installing OpenClaw v2026.2.26
✓ OpenClaw npm package installed
✓ OpenClaw installed
[3/3] Finalizing setup
!PATH missing npm global bin : /home/ubuntu/.npm-global/bin
This can make openclaw show as new terminals.
Fix (zsh: ~/.zshrc, bash: ~/.bashrc):
PATH=
🦞 OpenClaw installed successfully (2026.2.26)! All !
I promise to only judge your code a little bit.
· Starting setup
🦞 OpenClaw 2026.2.26 (bc50708) — Ship fast, faster.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██
██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██
██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🦞 OPENCLAW 🦞
┌ OpenClaw onboarding
│ ◇ Security ─────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Security warning — please .
│ │
│ OpenClaw is a hobby project and still beta. Expect sharp edges.
│ By default, OpenClaw is a personal agent: one trusted operator boundary.
│ This bot can files and run actions tools are enabled.
│ A bad prompt can trick it into doing unsafe things.
│ │
│ OpenClaw is not a hostile multi-tenant boundary by default.
│ If multiple can message one tool-enabled agent, they share that delegated tool
│ authority.
│ │
│ If yout run
│ OpenClaw.
│ Ask someone experienced to before enabling tools or exposing it to the internet.
│ │
│ Recommended baseline:
│ - Pairing/allowlists + mention gating.
│ - Multi-user/shared inbox: trust boundaries (separate gateway/credentials, ideally
│ separate OS /hosts).
│ - Sandbox + least-privilege tools.
│ - Shared inboxes: isolate DM sessions (`session.dmScope: per-channel-peer`) and keep
│ tool access minimal.
│ - Keep secrets out of the agents localStorage (openclaw.control.settings.v1).
│ Open the dashboard anytime: openclaw dashboard --no-open
│ If prompted: the token into Control UI settings (or use the tokenized dashboard
│ URL).
│ │
├─────────────────────────────────────────────────────────────────────────────────────────╯
│ ◇ How you want to hatch your bot?
Open the Web UI
│ ◇ Dashboard ready ────────────────────────────────────────────────────────────────╮
│ │
│ Dashboard (with token):
│ http://127.0.0.1:18789/#token=YOUR_TOKEN
│ Copy/paste this URL a browser on this machine to control OpenClaw.
│ No GUI detected. Open from your computer:
│ ssh -N -L 18789:127.0.0.1:18789 [email protected]
│ Then open:
│ http://localhost:18789/
│ http://localhost:18789/#token=YOUR_TOKEN
│ Docs:
│ https://docs.openclaw.ai/gateway/remote
│ https://docs.openclaw.ai/web/control-ui
│ │
├──────────────────────────────────────────────────────────────────────────────────╯
│ ◇ Workspace backup ────────────────────────────────────────╮
│ │
│ Back up your agent workspace.
│ Docs: https://docs.openclaw.ai/concepts/agent-workspace
│ │
├───────────────────────────────────────────────────────────╯
│ ◇ Security ──────────────────────────────────────────────────────╮
│ │
│ Running agents on your computer is risky — harden your setup:
│ https://docs.openclaw.ai/security
│ │
├─────────────────────────────────────────────────────────────────╯
│ ◇ Shell completion ────────────────────────────────────────────────────────╮
│ │
│ Shell completion installed. Restart your shell or run: ~/.bashrc
│ │
├───────────────────────────────────────────────────────────────────────────╯
│ ◇ Web search (optional) ─────────────────────────────────────────────────────────────────╮
│ │
│ If you want your agent to be able to search the web, yout work.
│ │
│ Set it up interactively:
│ - Run: openclaw configure --section web
│ - Enable web_search and your Brave Search API key
│ │
│ Alternative: BRAVE_API_KEY the Gateway environment (no config changes).
│ Docs: https://docs.openclaw.ai/tools/web
│ │
├─────────────────────────────────────────────────────────────────────────────────────────╯
│ ◇ What now ─────────────────────────────────────────────────────────────╮
│ │
│ What now: https://openclaw.ai/showcase ().
│ │
├────────────────────────────────────────────────────────────────────────╯
│ └ Onboarding complete. Use the dashboard above to control OpenClaw.
ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$


