How to Self-Host OpenClaw on VPS in 2026: The Complete No-Frills Guide
OpenClaw crossed 375,000 GitHub stars in 2026. It’s the fastest-growing open-source AI agent project in history — and yet most people still don’t know you can run it on a $5 VPS and have your own personal AI assistant running 24/7.
This guide cuts through the noise. No fluff, no “it’s easy!” platitudes — just the actual steps that work, from a blank server to a fully running OpenClaw instance with HTTPS, connected to Telegram, with persistent storage.
Estimated reading time: 12 minutes. Time to deploy: 20-30 minutes.
Why Self-Host OpenClaw in 2026?
Here’s the deal with cloud AI assistants: you’re borrowing someone else’s machine, using someone else’s API, and trusting someone else with your conversations. For a lot of people, that’s fine. But if you’re a developer, a privacy nerd, or someone who wants real control over their AI infrastructure, self-hosting changes everything.
With OpenClaw self-hosted, you get:
- Your own API key, your own data — nothing goes to a third party
- Connect to any LLM you want — Anthropic, OpenAI, Ollama, Groq, or any OpenAI-compatible endpoint
- Run 24/7 on cheap infrastructure — a $5 VPS does the job for personal use
- Extend with skills — the ClawHub registry has community-built skills for web search, email, calendar, and more
- Multi-platform without monthly fees — Telegram, WhatsApp, Discord, Slack, Signal, iMessage… all connected simultaneously
The project hit 375K stars because it actually works. Let’s get it running.
What You Need Before Starting
Server requirements:
- VPS with 2 GB RAM minimum (4 GB recommended)
- Ubuntu 22.04 LTS or similar Linux distro
- Root SSH access
- A domain name pointed at your server (optional but required for HTTPS)
Software requirements:
- Docker Engine + Docker Compose v2
- About 15-30 minutes of focused work
AI provider:
- You need an API key from at least one LLM provider. Options:
– Anthropic (recommended — Claude is excellent for agentic tasks)
– OpenAI (GPT-4o or GPT-4o-mini)
– Groq (fast inference, free tier available)
– Ollama (run models locally, zero API cost)
For this guide, we’ll use Anthropic as the example since it produces the most reliable results for agentic workflows.
Step 1: Provision Your VPS
If you don’t have a VPS yet, grab one. I’ve tested this on Hetzner, DigitalOcean, and Vultr — all work fine. Hetzner’s CX22 (€3.50/month, 2 vCPU / 4 GB RAM) is the sweet spot for personal use.
Set up Ubuntu 22.04 LTS. When it arrives, SSH in as root and create a non-root user:
`bash
adduser ocuser
usermod -aG sudo ocuser
`
Log out and log back in as the new user for the rest of the setup.
Critical: Run everything as a non-root user. Running OpenClaw (or anything) as root is a security risk — if the agent gets compromised, the attacker gets root access to your entire server.
Step 2: Install Docker
Still logged in as your non-root user:
`bash
Update the system
sudo apt update && sudo apt upgrade -y
Install Docker
curl -fsSL https://get.docker.com | sh
Add your user to the docker group
sudo usermod -aG docker ocuser
Log out and back in for group changes to take effect
exit
ssh ocuser@your-server-ip
`
Verify Docker is working:
`bash
docker –version
docker compose version
`
Step 3: Create the Docker Compose File
Create a project directory and the Compose file:
`bash
mkdir openclaw && cd openclaw
`
Create docker-compose.yml:
`yaml
version: “3.9”
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
– “127.0.0.1:18789:18789”
volumes:
– ./config:/root/.openclaw
– ./workspace:/root/.openclaw/workspace
environment:
– ANTHROPIC_API_KEY=sk-ant-your-key-here
– NODE_ENV=production
healthcheck:
test: [“CMD”, “curl”, “-f”, “http://localhost:18789/health”]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
`
Important: The gateway binds to 127.0.0.1:18789, not 0.0.0.0:18789. This means the gateway is only reachable from the server itself, not from the public internet. Nginx (which we set up next) will handle incoming traffic and proxy it to this local port. This is the correct security posture.
Step 4: Set Up Your Environment Variables
Create a .env file in the same directory:
`bash
.env — never commit this to git
ANTHROPIC_API_KEY=sk-ant-your-key-here
NODE_ENV=production
`
Set strict permissions:
`bash
chmod 600 .env
`
Generate your API key at console.anthropic.com if you don’t have one.
Step 5: Start OpenClaw
`bash
docker compose up -d
`
Wait about 15 seconds, then check the logs:
`bash
docker compose logs -f openclaw
`
You should see something like OpenClaw gateway running on :18789. Hit Ctrl+C to exit the logs.
Step 6: Verify the Gateway
Test locally from the server:
`bash
curl -f http://localhost:18789/health
`
If you get a 200 OK response, the gateway is healthy. Now test that it can actually respond to messages by opening the Control UI at http://your-server-ip:18789/ — but note that without HTTPS, your browser may warn you. Let’s fix that next.
Step 7: Install Nginx as a Reverse Proxy
Install Nginx:
`bash
sudo apt install -y nginx
`
Create a site configuration:
`bash
sudo nano /etc/nginx/sites-available/openclaw
`
Paste this configuration:
`nginx
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:18789;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
`
Enable the site:
`bash
sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
`
Point your domain’s A record to your server’s IP, then test the HTTP version. Once that’s working, get SSL.
Step 8: Get SSL with Let’s Encrypt
`bash
sudo apt install -y certbot python3-certbot-nginx
sudo certbot –nginx -d your-domain.com
`
Certbot handles certificate issuance and automatic renewal. You now have https://your-domain.com working with a valid TLS certificate.
Note: Let’s Encrypt certificates expire after 90 days. Certbot sets up an automatic renewal cron job that runs twice daily. As long as your server stays on, this renewal happens automatically without you doing anything.
Step 9: Connect Telegram (Your First Channel)
Telegram is the easiest first channel — it requires only a bot token, with no QR pairing or local session state.
1. Open Telegram and message @BotFather
2. Send /newbot
3. Choose a name and username (must end in bot)
4. Copy the token — it looks like 8346812749:AAHxxxxxxxxxxxxxxxxxxxxxx
5. In the OpenClaw dashboard → Channels → Telegram → paste the token and save
6. Message your new bot in Telegram
Within seconds, OpenClaw should respond. Try asking: “What’s today’s date?”
If it responds, your core setup is complete.
Step 10: Install Your First ClawHub Skill
Skills extend what OpenClaw can do. Browse available skills at clawhub.ai.
To install a skill via the dashboard:
1. Go to Skills → Browse Registry
2. Find a skill you want (like web search or a memory enhancement)
3. Click install
Or via CLI inside the container:
`bash
docker exec openclaw openclaw skills install @clawhub/web-search
`
Common Mistakes and Fixes
Container won’t start — port already in use:
`bash
lsof -i :18789
Kill the conflicting process, or change the port in docker-compose.yml
`
Telegram messages not received:
- Double-check the bot token is correct
- Verify the bot hasn’t been blocked by Telegram
- Check logs:
docker compose logs openclaw | grep telegram
Gateway reports unhealthy:
- Wait 20-30 seconds after starting — the healthcheck takes time
- Check logs:
docker compose logs openclaw
- Verify your
ANTHROPIC_API_KEYis valid and has credits
Nginx 502 errors:
- Make sure the
proxy_set_header UpgradeandConnection "upgrade"headers are present — OpenClaw uses WebSockets and will fail silently without them
Setting Up Automated Backups
Your OpenClaw configuration, skills, memory, and conversation history all live in ./config and ./workspace. Back this up daily:
`bash
Create a backup script
cat < ~/backup-openclaw.sh
#!/bin/bash
set -e
TIMESTAMP=$(date +%Y%m%d-%H%M)
BACKUP_FILE=”/tmp/openclaw-${TIMESTAMP}.tar.gz”
tar -czf “$BACKUP_FILE” ~/openclaw/config ~/openclaw/workspace
Upload to your storage solution (S3, Backblaze B2, etc.)
rclone copy “$BACKUP_FILE” remote:openclaw-backups/
rm “$BACKUP_FILE”
echo “Backup complete: $TIMESTAMP”
EOF
chmod +x ~/backup-openclaw.sh
Schedule daily at 2:30 AM
(crontab -l 2>/dev/null; echo “30 2 * ~/backup-openclaw.sh >> ~/backup.log 2>&1″) | crontab –
`
Updating OpenClaw
OpenClaw releases frequently. To update:
`bash
cd ~/openclaw
docker compose pull
docker compose up -d
docker image prune -f
`
Done. Your config and workspace are preserved by the volumes.
What’s Next?
Once your OpenClaw instance is running, you can:
- Connect more channels — WhatsApp, Discord, Slack, Signal, iMessage, and more
- Explore ClawHub — hundreds of community skills to extend capabilities
- Set up multiple users — add team members or family with individual accounts
- Integrate with your tools — calendar, email, GitHub, Notion, and more
The Bottom Line
Self-hosting OpenClaw in 2026 is genuinely one of the highest-value things you can do if you want real control over your AI infrastructure. The $5/month VPS cost is trivial, the setup takes 30 minutes, and what you get — a 24/7 AI assistant that you fully own — is genuinely useful.
The official docs at docs.openclaw.ai are solid if you need to go deeper. This guide covers the path that works. Start there and iterate.
Have questions or run into issues? Leave a comment below and I’ll do my best to help.
Related Articles
Get Notified About New Articles
One email per week when I publish a new article or update an existing one. New AI tool reviews, deployment updates, behind-the-scenes notes. No marketing, no spam, unsubscribe in one click.
Or learn more · RSS feed
- How to Set Up Claude Code with the MiniMax API in 2026
- How to Set Up Hermes Web UI for AI Agent Management in 2026
- How to Self-Host n8n for $5/Month
- OpenClaw vs ChatGPT: Why Self-Hosting Wins for Power Users in 2026
Get Notified About New Articles
One email per week when I publish a new article or update an existing one. No marketing, no spam.