Back to blog
How to Set Up OpenClaw on a Hetzner VPS — Complete Guide (2026)
OpenClawHetznerVPSAI AgentSelf-HostingTutorial

How to Set Up OpenClaw on a Hetzner VPS — Complete Guide (2026)

A step-by-step guide to running your own AI agent 24/7 on a €4/month Hetzner server. From zero to a fully working OpenClaw setup with Telegram, web dashboard, and always-on AI assistant. Updated for OpenClaw 2026.3.

9 min read

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:

What You'll Need

Step 1: Create Your Hetzner Server

Log into Hetzner Cloud Console and create a new 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:

  1. Check for Node.js 22+ (install it if missing)
  2. Install the OpenClaw CLI globally via npm
  3. 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

Model Authentication

OpenClaw supports a wide range of providers — pick whichever you prefer:

You can mix providers — use one as default and others for specific tasks. The wizard will ask for your API key.

Channels

Daemon

Gateway Token

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_IP and access via localhost: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

  1. Open Telegram and search for @BotFather
  2. Send /newbot
  3. Pick a name (e.g., "My AI Agent")
  4. Pick a username (e.g., my_ai_agent_bot)
  5. 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:

  1. Get a free API key at brave.com/search/api (2,000 queries/month free)
  2. 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

  1. Check the bot token is correct
  2. Check pairing: openclaw approvals pending
  3. 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:

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.

Back to all posts