VPS Bootstrap
Full deployment and disaster recovery framework for OpenClaw on Ubuntu VPS.
Overview
Three scripts handle the complete lifecycle:
- 1.
bootstrap.sh — Fresh VPS → fully operational OpenClaw (15-20 min) restore.sh — Restore workspace, config, secrets, and crons from backupverify.sh — Post-deployment verification (all-green = ready)
Quick Start
New VPS setup
CODEBLOCK0
Restore from backup
CODEBLOCK1
Verify everything works
CODEBLOCK2
What bootstrap.sh does
Sequential installation with error handling at each step:
- 1. System packages — build-essential, curl, git, jq, unzip, etc.
- Node.js — Latest LTS via NodeSource
- Google Chrome — Stable channel + headless shim for browser tools
- OpenClaw — Global npm install + gateway service setup
- Security baseline — UFW firewall, fail2ban, SSH key-only auth
- Service setup — systemd user service with auto-restart + linger
Each step is idempotent — safe to re-run if interrupted.
What restore.sh does
Extracts a backup tarball and restores:
- - Workspace files (SOUL.md, MEMORY.md, AGENTS.md, memory/, scripts/)
- OpenClaw config (openclaw.json, .env)
- Cron database
- GPG keys + password store (encrypted secrets)
- OAuth credentials (GOG, rclone)
- System config snapshot
What verify.sh does
Runs 10+ checks and reports pass/fail:
- - OpenClaw gateway running and healthy
- Telegram/Discord providers connected
- Browser tools functional
- Backup system operational
- Cron jobs loaded
- SSH security baseline
- Disk space and memory
Backup Script (Optional)
For automated daily backups, see references/backup-guide.md.
Customization
Edit scripts/bootstrap.sh variables at the top:
CODEBLOCK3
Requirements
- - Ubuntu 22.04+ or Debian 12+
- Root or sudo access
- 2GB+ RAM recommended
- SSH key access configured
Security Notes
- - Scripts never store secrets in plaintext in the skill itself
- GPG keys are backed up encrypted
- SSH is hardened to key-only authentication
- Gateway binds to localhost by default
VPS 引导部署
适用于 Ubuntu VPS 上 OpenClaw 的完整部署与灾难恢复框架。
概述
三个脚本处理完整的生命周期:
- 1. bootstrap.sh — 从全新 VPS 到完全可运行的 OpenClaw(15-20 分钟)
- restore.sh — 从备份中恢复工作区、配置、密钥和定时任务
- verify.sh — 部署后验证(全部通过 = 准备就绪)
快速开始
新 VPS 设置
bash
在全新的 Ubuntu 24.04 VPS 上
bash scripts/bootstrap.sh
从备份恢复
bash
bash scripts/restore.sh ~/openclaw-backup-*.tar.gz
验证一切正常
bash
bash scripts/verify.sh
bootstrap.sh 的功能
按顺序安装,每一步都有错误处理:
- 1. 系统包 — build-essential、curl、git、jq、unzip 等
- Node.js — 通过 NodeSource 安装最新 LTS 版本
- Google Chrome — 稳定版 + 无头模式 shim,用于浏览器工具
- OpenClaw — 全局 npm 安装 + 网关服务设置
- 安全基线 — UFW 防火墙、fail2ban、仅 SSH 密钥认证
- 服务设置 — 带自动重启的 systemd 用户服务 + linger
每个步骤都是幂等的 — 如果中断可安全重新运行。
restore.sh 的功能
解压备份压缩包并恢复:
- - 工作区文件(SOUL.md、MEMORY.md、AGENTS.md、memory/、scripts/)
- OpenClaw 配置(openclaw.json、.env)
- Cron 数据库
- GPG 密钥 + 密码存储(加密的密钥)
- OAuth 凭据(GOG、rclone)
- 系统配置快照
verify.sh 的功能
运行 10 多项检查并报告通过/失败:
- - OpenClaw 网关运行正常且健康
- Telegram/Discord 提供商已连接
- 浏览器工具功能正常
- 备份系统正常运行
- Cron 任务已加载
- SSH 安全基线
- 磁盘空间和内存
备份脚本(可选)
如需自动每日备份,请参阅 references/backup-guide.md。
自定义配置
编辑 scripts/bootstrap.sh 顶部的变量:
bash
OPENCLAW_PORT=18789 # 网关端口
ENABLE_FIREWALL=true # UFW 设置
ENABLE_FAIL2BAN=true # SSH 保护
INSTALL_CHROME=true # 浏览器工具支持
系统要求
- - Ubuntu 22.04+ 或 Debian 12+
- Root 或 sudo 权限
- 建议 2GB+ 内存
- 已配置 SSH 密钥访问
安全说明
- - 脚本本身从不以明文存储密钥
- GPG 密钥以加密方式备份
- SSH 已强化为仅密钥认证
- 网关默认绑定到 localhost