2.4 Linux 与服务器安装
A. Linux 本机安装
1) 官方一键安装
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
安装过程终端显示示例:
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
🦞 OpenClaw Installer
curl for conversations.
✓ Detected: linux
Install plan
OS: linux
Install method: npm
Requested version: latest
Onboarding: skipped
[1/3] Preparing environment
· Node.js not found, installing it now
· Installing Node.js via NodeSource
· Installing Linux build tools (make/g++/cmake/python3)
✓ Build tools installed
✓ Node.js v22 installed
· Active Node.js: v22.22.1 (/usr/bin/node)
· Active npm: 10.9.4 (/usr/bin/npm)
[2/3] Installing OpenClaw
· Git not found, installing it now
✓ Git installed
· Configuring npm for user-local installs
✓ npm configured for user installs
· Installing OpenClaw v2026.3.23-2
✓ 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 (OpenClaw 2026.3.23-2 (7ffe7e4))!
cracks claws Alright, what are we building?
· Skipping onboard (requested); run openclaw onboard later
FAQ: https://docs.openclaw.ai/start/faq
注:其中有一段这样的提醒,如果打开新的终端执行openclaw命令可能会提醒
command not found
! 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"
解决办法是在~/.bashrc文件最后加上:
export PATH="/home/ubuntu/.npm-global/bin:$PATH"
然后执行
source ~/.bashrc
2) 运行引导并安装守护服务
推荐命令(同时安装守护服务):
openclaw onboard --install-daemon
你会进入交互式引导。下面按常见步骤给出“新手推荐选项”。
引导配置请看: 引导配置
3) 验证
openclaw --version
openclaw doctor
openclaw gateway status
openclaw dashboard
B. Linux 服务器 / VPS 部署
适合 24x7 在线托管。建议把服务器视为“主状态机”。
1) 安装与初始化
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemon
2) 健康检查
openclaw doctor
openclaw gateway status
openclaw health
3) 远程访问建议
- 优先使用 SSH 隧道或 Tailscale
- 若开放到
lan/tailnet,务必启用gateway.auth.token或gateway.auth.password - 定期备份
~/.openclaw(配置、认证、会话都在这里)