Hosting OpenClaw on a VPS — Complete Guide
Step-by-step guide to running OpenClaw on a VPS including setup, optimization, SSH configuration, troubleshooting disconnects, and best practices for Hetzner, DigitalOcean, Contabo, and Google Cloud.
⚠️ The Problem
Users face multiple challenges hosting OpenClaw on VPS: WebSocket disconnects (error 1006), SSH connection issues between local OpenClaw and remote VPS, gateway token configuration confusion, incomplete setup on Raspberry Pi, skills not loading on Linux, and confusion about the web dashboard. Common errors include 'disconnected (1006): no reason', 'command not found' after interrupted setup, 'Config path not found: autonomy', and difficulty getting the gateway dashboard accessible.
🔍 Why This Happens
Root causes include: (1) Gateway not running or token mismatch between config and environment. (2) Cloud provider IPs (especially Hetzner) getting rate-limited by Discord. (3) Interrupted setup leaving incomplete configuration (no ~/.config/clawdbot directory). (4) SSH keys not properly configured for remote VPS access. (5) Confusion between gateway.token and gateway.auth.token config paths. (6) Resource constraints on minimal VPS instances. (7) ClawdHub CLI not available on Linux VPS without manual setup. (8) Raspberry Pi requiring arm64-compatible models.
✅ The Fix
VPS Requirements & Recommendations
Minimum specs:
- 1 vCPU, 1GB RAM, 500MB disk
Recommended:
- 2GB RAM (for logs, media processing, multiple channels)
- Ubuntu LTS (most tested platform)
Best practices:
- Run Gateway 24/7 — cron jobs won't fire if it sleeps
- Back up workspace (
~/clawd) to a private git repo - Keep state separate:
~/.clawdbotfor config,~/clawdfor workspace
Initial VPS Setup
# 1. Install Node.js 22+ (recommended method)curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt-get install -y nodejs# 2. Install OpenClawcurl -fsSL https://clawd.bot/install.sh | bash# 3. Run initial configurationclawdbot configure# 4. Start the gatewayclawdbot gateway startFixing Interrupted Setup (RPi / VPS)
If setup was cancelled or interrupted and you get 'command not found':
# Create config directory if missingmkdir -p ~/.config/clawdbot# Re-run configuration wizardclawdbot configure# If clawdbot command not found, reinstallcurl -fsSL https://clawd.bot/install.sh | bashFor Raspberry Pi specifically:
- Ensure you're using arm64-compatible models if running local LLMs
- Cloud API models (OpenAI, Anthropic, OpenRouter) work on all architectures
Fixing WebSocket Disconnect (1006) on Hetzner/Cloud VPS
# 1. Check if gateway is runningclawdbot gateway status# 2. If not running, start itclawdbot gateway start# 3. Check logs for detailsclawdbot gateway logsCommon causes on cloud VPS:
- Gateway process not running
- Token mismatch between config and environment
- Discord rate-limiting cloud IPs (try VPN temporarily)
- Resource exhaustion
# Check resourcesfree -hdf -h# Restart gatewayclawdbot gateway restartGateway Token Configuration
Important: The dashboard uses gateway.auth.token, NOT gateway.token.
# Check current tokenclawdbot config get gateway.auth.token# Set a token if emptyclawdbot config set gateway.auth.token "your-secure-random-token"# Or use environment variableexport CLAWDBOT_GATEWAY_TOKEN="your-token-here"# Restart after changesclawdbot gateway restartToken location summary:
- ❌
gateway.token— ignored - ✅
gateway.auth.token— used by dashboard - ✅
CLAWDBOT_GATEWAY_TOKENenv var — also works
Connecting Local OpenClaw to Remote VPS via SSH
To have OpenClaw on your local machine control a remote VPS:
# 1. Generate SSH key if you don't have onessh-keygen -t ed25519 -C "openclaw-vps"# 2. Copy public key to VPSssh-copy-id user@your-vps-ip# 3. Test connection manually firstssh user@your-vps-ip# 4. Configure OpenClaw to use SSH# Add to your TOOLS.md or workspace config:# SSH: user@your-vps-ip for web server managementFor Contabo/DigitalOcean/Hetzner:
- Ensure SSH is enabled in your VPS control panel
- Check firewall allows port 22
- Use key-based auth (more reliable than passwords)
Installing Skills on Linux VPS
ClawdHub UI isn't available on headless Linux. Use CLI:
# Install ClawdHub CLInpm i -g clawdhub# orpnpm add -g clawdhub# Search for skillsclawdhub search "web search"# Install a skillclawdhub install skill-slug# Update all skillsclawdhub update --allIf ClawdHub isn't working, install manually:
# Create skills foldermkdir -p ~/clawd/skills# Clone skills repositorygit clone https://github.com/clawdbot/clawdbot.git ~/clawd-skillscp -r ~/clawd-skills/skills/* ~/clawd/skills/# Configure workspace skills directoryclawdbot config set skills.dir ~/clawd/skills# Restart to loadclawdbot gateway restartAccessing the Gateway Dashboard
The web dashboard shows gateway status and connected clients.
# Get dashboard URLclawdbot gateway status# Default: http://localhost:3333 (or configured port)# For remote access, use SSH tunnel:ssh -L 3333:localhost:3333 user@your-vps-ip# Then access http://localhost:3333 in your browserFor public access (not recommended without auth):
- Set up nginx/caddy reverse proxy
- Add SSL certificate (Let's Encrypt)
- Configure
gateway.auth.tokenfor protection
Uninstalling OpenClaw on Linux
The docs may be missing this command:
# For openclaw packagenpm uninstall -g openclaw# For clawdbot packagenpm uninstall -g clawdbot# orpnpm remove -g clawdbot# Remove config and datarm -rf ~/.clawdbotrm -rf ~/.config/clawdbotRunning Gateway as a Service (Systemd)
For production VPS, run as a systemd service:
# Create service filesudo nano /etc/systemd/system/clawdbot.service[Unit]Description=Clawdbot GatewayAfter=network.target[Service]Type=simpleUser=your-usernameWorkingDirectory=/home/your-usernameExecStart=/usr/bin/clawdbot gateway start --foregroundRestart=alwaysRestartSec=10Environment=NODE_ENV=production[Install]WantedBy=multi-user.target# Enable and start servicesudo systemctl daemon-reloadsudo systemctl enable clawdbotsudo systemctl start clawdbot# Check statussudo systemctl status clawdbot# View logsjournalctl -u clawdbot -fDiscord Moderation on VPS
OpenClaw has basic moderation capabilities:
Supported:
- ✅ React to messages, pin/unpin
- ✅ Search message history, create threads
- ✅ Manage channels, roles, categories
- ✅ Kick/ban users via API
Not built-in:
- ❌ Auto-moderation (spam detection)
- ❌ Automated warnings/mutes
- ❌ Anti-raid protection
- ❌ Custom mod logs
For full moderation, integrate dedicated bots alongside OpenClaw.
🔥 Your AI should run your business, not just answer questions.
We'll show you how.Free to join.
📋 Quick Commands
| Command | Description |
|---|---|
| clawdbot gateway start | Start the gateway daemon |
| clawdbot gateway status | Check gateway status and dashboard URL |
| clawdbot gateway logs | View gateway logs for debugging |
| clawdbot gateway restart | Restart gateway (fixes many issues) |
| clawdbot configure | Run setup wizard (use after interrupted install) |
| clawdbot config set gateway.auth.token TOKEN | Set dashboard authentication token |
| clawdbot config get gateway.auth.token | Check current gateway token |
| npm uninstall -g openclaw | Uninstall openclaw package (legacy) |
| npm uninstall -g clawdbot | Uninstall clawdbot package |
| ssh-copy-id user@vps-ip | Copy SSH key to VPS for passwordless access |
| clawdhub search QUERY | Search for skills (Linux CLI) |
| clawdhub install SKILL | Install a skill on Linux VPS |
| sudo systemctl status clawdbot | Check systemd service status |
Related Issues
📚 You Might Also Like
VPS vs Mac Mini vs Raspberry Pi: Where Should You Run OpenClaw?
The answer isn't \\"whichever is cheapest.\\" Each hosting option has a different threat profile, different failure modes, and different security implications.
How to Set Up OpenClaw on Mac Mini (Perfect Always-On Setup)
The ideal dedicated AI assistant setup. Buy once, runs forever, no monthly fees for hosting.
Hetzner vs DigitalOcean
Which cloud VPS is right for your project?
Discord
Add your AI assistant to Discord servers and DMs. Get help, manage tasks, and run automations directly from your Discord channels.
🐙 Your AI should run your business.
Weekly live builds + template vault. We'll show you how to make AI actually work.Free to join.
Join Vibe Combinator →