Skip to content
Last updated

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

Step 1: Update the server

Command
sudo apt update && sudo apt upgrade -ysudo apt install -y curl git ca-certificates

Step 2: Install Docker and Compose

Command
sudo apt install -y docker.io docker-composedocker --versiondocker-compose --version

Step 3: Fix Docker permissions

Command
sudo usermod -aG docker $USER

Log out and back in before you continue.

Step 4: Clone the repository

Command
git clone https://github.com/openclaw/openclaw.gitcd openclaw

Step 5: Run the official Docker setup

Command
chmod +x ./docker-setup.sh./docker-setup.sh

Step 6: Run onboarding from the CLI container

Command
docker compose exec openclaw-cli openclaw onboard --flow quickstart

Step 7: Validate logs

Command
docker compose logs -f openclaw-gateway

Option B: Native install

Step 1: Install OpenClaw

Command
curl -fsSL https://openclaw.bot/install.sh | bashnpm i -g openclaw@latest

Step 2: Run onboarding and install the daemon

Command
openclaw onboard --install-daemon

Step 3: Verify runtime

Command
openclaw healthopenclaw status --all

Restart and stop OpenClaw safely

Docker restart

Command
docker compose restart openclaw-gateway openclaw-cli

Docker stop

Command
docker compose stop

Native restart

Command
openclaw gateway restart || openclaw restart

Native stop

Command
openclaw stop || pkill -f openclaw

Persistent data and backups

The important host paths are usually:

  • ~/.openclaw/
  • ~/.openclaw/workspace/

Create a quick backup:

Command
tar -czf openclaw-backup.tar.gz ~/.openclaw

Minimal hardening

Command
sudo ufw allow OpenSSHsudo ufw enablesudo ufw status

Do 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-ip

Common 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.