Last updatedAuthor OpenClaw Guide
OpenClaw VPS Setup (Docker or Native)
What you'll achieve
- Deploy OpenClaw on a VPS with Docker or a native setup
- Keep configs and state persistent
- Learn how to restart, stop, and verify the gateway
- Avoid common Docker, networking, permission, and data-loss pitfalls
VPS sizing recommendation
- 2 vCPU / 2 GB RAM / 20 GB SSD minimum
- Ubuntu 22.04 or later
Option A: Docker (recommended)
Step 1: Update the server
Command
sudo apt update && sudo apt upgrade -ysudo apt install -y curl git ca-certificatesStep 2: Install Docker and Compose
Command
sudo apt install -y docker.io docker-composedocker --versiondocker-compose --versionStep 3: Fix Docker permissions
Command
sudo usermod -aG docker $USERLog out and back in before you continue.
Step 4: Clone the repository
Command
git clone https://github.com/openclaw/openclaw.gitcd openclawStep 5: Run the official Docker setup
Command
chmod +x ./docker-setup.sh./docker-setup.shStep 6: Run onboarding from the CLI container
Command
docker compose exec openclaw-cli openclaw onboard --flow quickstartStep 7: Validate logs
Command
docker compose logs -f openclaw-gatewayOption B: Native install
Step 1: Install OpenClaw
Command
curl -fsSL https://openclaw.bot/install.sh | bashnpm i -g openclaw@latestStep 2: Run onboarding and install the daemon
Command
openclaw onboard --install-daemonStep 3: Verify runtime
Command
openclaw healthopenclaw status --allRestart and stop OpenClaw safely
Docker restart
Command
docker compose restart openclaw-gateway openclaw-cliDocker stop
Command
docker compose stopNative restart
Command
openclaw gateway restart || openclaw restartNative stop
Command
openclaw stop || pkill -f openclawPersistent data and backups
The important host paths are usually:
~/.openclaw/~/.openclaw/workspace/
Create a quick backup:
Command
tar -czf openclaw-backup.tar.gz ~/.openclawMinimal hardening
Command
sudo ufw allow OpenSSHsudo ufw enablesudo ufw statusDo not expose the gateway to the public internet unless you fully understand the risk. Keep it on localhost or protect it with tokens and reverse proxy auth.
Secure Control UI access
Use SSH tunneling instead of exposing ports:
Command
ssh -N -L 18789:127.0.0.1:18789 user@your-vps-ipCommon Docker / VPS questions
When should I use Docker?
Use Docker if you want the cleanest repeatable setup and easier persistence management.
When should I use native install?
Use native install only if you know why you need it or your environment does not support Docker cleanly.
Where should I go for gateway tokens, browser relay, or skills?
Continue with advanced configuration for gateway token, browser relay, and skill-related settings.