How to Set Up OpenClaw on a Hetzner VPS — Complete Guide (2026)
Updated March 2026 for OpenClaw 2026.3. Original guide published February 2026.
Want your own AI agent running 24/7 for less than the price of a coffee? This guide walks you through setting up OpenClaw on a Hetzner VPS from scratch. No Docker needed — just a clean Linux server and about 20 minutes.
I've been running this exact setup for months. It handles my projects, monitors my services, manages social media, and responds to messages on Telegram around the clock. Here's exactly how to replicate it.
Note: OpenClaw also has an official Docker-based Hetzner guide if you prefer containers. This guide covers the simpler bare-metal approach.
What You'll Get
By the end of this guide, you'll have:
- An always-on AI agent running on your own server
- A web dashboard for chatting and managing your agent
- Telegram integration so you can message your agent from your phone
- A persistent workspace where your agent can read/write files, run commands, and manage projects
- Automatic restarts if the server reboots
- Cron jobs for scheduled automation
What You'll Need
- A Hetzner account (sign up here)
- An API key from your preferred AI provider (Anthropic, OpenAI, Google, xAI, and many more are supported)
- A Telegram account (for the bot, optional but recommended)
- Basic comfort with the command line
- ~20 minutes
Step 1: Create Your Hetzner Server
Log into Hetzner Cloud Console and create a new server:
- Location: Pick the closest to you (I use Helsinki)
- Image: Ubuntu 24.04
- Type: CX22 (2 vCPU, 4GB RAM, 40GB disk) — €4.35/month
- SSH Key: Add your public key (or set a root password)
- Name: Whatever you want (mine is
openclaw-server)
The CX22 is plenty for OpenClaw. It uses about 1-1.5GB RAM idle, so 4GB gives you comfortable headroom for running scripts, scrapers, and builds alongside the agent.
Click Create & Buy. Your server will be ready in about 30 seconds.
Step 2: Connect and Update
SSH into your fresh server:
ssh root@YOUR_SERVER_IP
Update everything:
apt update && apt upgrade -y
Step 3: Install OpenClaw
The recommended way is the installer script — it handles Node.js detection/installation, installs the CLI, and launches the onboarding wizard all in one go:
curl -fsSL https://openclaw.ai/install.sh | bash
That's it. The script will:
- Check for Node.js 22+ (install it if missing)
- Install the OpenClaw CLI globally via npm
- Launch the onboarding wizard
If you prefer to do it manually, install Node.js 22+ first, then:
npm install -g openclaw@latest
openclaw onboard --install-daemon
Tip: If you get "command not found" after installing, add the npm global bin to your PATH:
export PATH="$(npm prefix -g)/bin:$PATH" echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc
Step 4: The Onboarding Wizard
The wizard walks you through everything interactively. Here's what to expect:
Gateway Setup
- Local or Remote: Choose Local (you're on the server)
- Port: Default
18789is fine - Bind: Choose
lanif you want remote access, orloopbackfor local only
Model Authentication
OpenClaw supports a wide range of providers — pick whichever you prefer:
- Anthropic (Claude) — great all-rounder
- Google (Gemini) — good for vision and multimodal tasks
- OpenAI (GPT-4o) — solid alternative
- xAI, OpenRouter, Together, Mistral, and many more
You can mix providers — use one as default and others for specific tasks. The wizard will ask for your API key.
Channels
- Telegram: If you want Telegram integration (highly recommended), you'll need a bot token. More on this in Step 6.
- Discord, Signal, Slack, WhatsApp, iMessage, IRC, and Google Chat are also supported — skip for now and add them later.
Daemon
- Install as service: Say yes. This creates a systemd service so OpenClaw starts automatically on boot and restarts if it crashes.
Gateway Token
- The wizard generates a security token. Save this somewhere safe — you'll need it to access the web dashboard.
Step 5: Verify It's Running
Check everything is working:
openclaw doctor # Check for config issues
openclaw gateway status # Gateway service status
openclaw status # Full status overview
The web dashboard is now available at http://YOUR_SERVER_IP:18789/. You'll need the gateway token from the wizard to log in.
Security note: If your gateway is bound to
lan, anyone who knows your IP and token can access it. For production use, either:
- Use an SSH tunnel:
ssh -N -L 18789:127.0.0.1:18789 root@YOUR_SERVER_IPand access vialocalhost:18789- Set up Tailscale for private networking
- Use a reverse proxy with HTTPS
Step 6: Set Up Telegram (Recommended)
Telegram is the best way to talk to your agent from your phone. Here's how:
Create a Telegram Bot
- Open Telegram and search for @BotFather
- Send
/newbot - Pick a name (e.g., "My AI Agent")
- Pick a username (e.g.,
my_ai_agent_bot) - BotFather gives you a token — copy it
Add it to OpenClaw
If you didn't set it up during onboarding:
openclaw channels telegram setup
Or manually edit ~/.openclaw/openclaw.json and add:
{
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN_HERE"
}
}
}
Restart the gateway:
openclaw gateway restart
First Message
Open your bot in Telegram and send a message. The first time, you may need to approve the pairing. Check pending requests:
openclaw approvals pending
Now you can message your agent anytime, anywhere. It's like having a developer on call 24/7.
Step 7: Add Web Search (Optional but Recommended)
Give your agent the ability to search the web with a Brave Search API key:
- Get a free API key at brave.com/search/api (2,000 queries/month free)
- Add it to your config:
openclaw config set tools.web.search.apiKey YOUR_BRAVE_API_KEY
This lets your agent look things up, check documentation, and stay current on information.
Step 8: Set Up Your Workspace
Your agent's workspace lives at ~/.openclaw/workspace/. This is where it stores files, code, and project data:
cd ~/.openclaw/workspace
git clone https://github.com/your/project.git
Now your agent can read and work on your codebase directly.
Pro tip: Create an AGENTS.md
Create ~/.openclaw/workspace/AGENTS.md with instructions for your agent — what projects you're working on, your preferences, how you like things done. The agent reads this at the start of every session.
Pro tip: Create a SOUL.md
Create ~/.openclaw/workspace/SOUL.md to define your agent's personality. Want it casual? Professional? Funny? This is where you set the vibe.
Step 9: Install Useful Tools
Some tools make the agent much more capable:
# Git (usually pre-installed)
apt install -y git
# Build essentials (for npm packages with native deps)
apt install -y build-essential
# Python + uv (for AI image generation and other Python tools)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Chromium + Playwright (if you want web scraping/browser automation)
npx playwright install --with-deps chromium
Install Skills
OpenClaw has a growing library of community skills at clawhub.com. Browse and install what fits your workflow — GitHub management, Google Workspace, image generation, weather, and more.
Step 10: Set Up Automation (Cron Jobs)
One of OpenClaw's most powerful features is scheduled automation. Your agent can run tasks on a schedule without you lifting a finger:
# Run a task every morning at 8am Stockholm time
openclaw cron add \
--name "morning-check" \
--cron "0 8 * * *" \
--tz "Europe/Stockholm" \
--session isolated \
--message "Check my emails and calendar, summarize anything important"
# List all cron jobs
openclaw cron list
# Run a one-shot task in 20 minutes
openclaw cron add \
--name "reminder" \
--at "+20m" \
--message "Remind Andy to check the deployment" \
--delete-after-run
Keeping It Updated
OpenClaw updates frequently. To update:
openclaw update
Or manually:
npm install -g openclaw@latest
openclaw gateway restart
Check for issues after updating:
openclaw doctor
Cost Breakdown
Here's what this setup actually costs per month:
| Item | Cost | |------|------| | Hetzner CX22 | €4.35/mo | | AI API (depends on provider & usage) | ~$5-50/mo | | Brave Search API (free tier) | $0 | | Total | ~€10-55/mo |
The API cost depends on your provider and usage. Light usage (a few chats a day) with Gemini Flash might be $2/month. Heavy usage with Claude Opus could be $50+. You can mix models — use a cheap model as default and switch to a powerful one for complex tasks. Monitor usage with openclaw status.
Troubleshooting
"openclaw: command not found"
export PATH="$(npm prefix -g)/bin:$PATH"
Gateway won't start
openclaw gateway --verbose # Run in foreground to see errors
journalctl -u openclaw-gateway -f # Check systemd logs
Check for common issues
openclaw doctor # Diagnoses config problems, missing deps, etc.
Telegram bot not responding
- Check the bot token is correct
- Check pairing:
openclaw approvals pending - Restart:
openclaw gateway restart
High memory usage
The CX22 has 4GB. If you're running other services too, watch memory:
free -h
htop
Server rebooted and agent is down
If you installed the daemon during onboarding, it should auto-start. If not:
openclaw gateway start
What's Next
Once you're up and running, explore:
- Cron jobs: Schedule your agent to do things automatically
- Skills: Install community skills for GitHub, Google Workspace, image generation, and more
- Multi-agent setups: Spawn sub-agents for specific tasks
- Nodes: Connect your phone or laptop as a "node" so your agent can use your local screen, camera, and apps
- ACP (Agent Control Protocol): Run Claude Code, Gemini CLI, or other coding agents as sub-agents
The beauty of this setup is that it grows with you. Start with a simple chat bot, and gradually give it more responsibilities as you build trust in the workflow.
Running into issues? The OpenClaw Discord is genuinely helpful, and the docs are comprehensive. Or just ask your agent to help debug itself — it's surprisingly good at that.
