Infrastructure

How to Run OpenClaw on a VPS (Complete Guide)

From zero to a fully running personal AI assistant โ€” on a $6/month server with 99.9% uptime. Step-by-step setup for DigitalOcean, Hetzner, or any Ubuntu VPS.

๐Ÿฆžclaw.mobile Editorial
ยทMarch 24, 2026ยท
10 min read

Why Run OpenClaw on a VPS?

Running OpenClaw on your laptop works fine for testing. But the moment you want your AI agent to respond to Telegram messages while you sleep, execute cron jobs at 3 AM, or monitor a website without your computer being on โ€” you need a server that's always up.

A VPS (Virtual Private Server) gives you exactly that: a dedicated Linux machine in a datacenter, running 24/7 for as little as $6/month. No power outages, no Wi-Fi hiccups, no "my laptop is in sleep mode."

99.9% Uptime

Datacenter-grade reliability. Your agent never sleeps.

$6/month

DigitalOcean's cheapest droplet handles OpenClaw perfectly.

Static IP

A fixed address. No DDNS, no port-forwarding headaches.

Choose a VPS Provider

Any provider that lets you spin up an Ubuntu 22.04 server will work. Here are the three most popular options for OpenClaw users:

ProviderCheapest PlanRAMBest For
โญ DigitalOcean$6/mo1 GBEasiest setup, great docs, free $200 credit for new users
๐Ÿ’ฐ Contabo~$5.50/mo4 GBBest raw value โ€” 4ร— the RAM for less money. German infrastructure.
Hetznerโ‚ฌ4/mo (~$4.50)2 GBBest value in Europe. 2x RAM for less money
Vultr$6/mo1 GBGlobal locations, reliable performance
Linode (Akamai)$5/mo1 GBSolid alternative with competitive pricing

Recommendation

Best value: Contabo โ€” 4GB RAM for ~$5.50/month, German datacenters. Easiest setup: DigitalOcean โ€” best docs, $200 free credit. Both run every command in this guide identically.

Create Your Server

Log into DigitalOcean, click Create โ†’ Droplets, and choose these settings:

01

Choose Region

Pick the region closest to you for the lowest latency. NYC, Frankfurt, or Singapore are popular choices.

02

Choose Image

Ubuntu 22.04 LTS (x64). Node.js requires Ubuntu 20.04+ โ€” 22.04 is rock-solid.

03

Choose Size

Basic Shared CPU โ†’ Regular โ†’ 1 GB / 1 vCPU / 25 GB SSD = $6/month. This is enough for OpenClaw.

04

Add SSH Key

Upload your public SSH key (~/.ssh/id_rsa.pub) or generate one in the DigitalOcean dashboard. Password auth is less secure.

05

Create Droplet

Click Create Droplet. Your server will be live in about 60 seconds with a static IP address.

Once your droplet is ready, SSH in:

ssh root@YOUR_DROPLET_IP

Install OpenClaw

OpenClaw requires Node.js 20+. Start by updating your server and installing the dependencies:

Step 1 โ€” Update the system

apt update && apt upgrade -y

Step 2 โ€” Install Node.js 22 via NodeSource

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

Step 3 โ€” Verify Node version

node --version
# Should print v22.x.x or higher

Step 4 โ€” Install OpenClaw globally

npm install -g openclaw

Step 5 โ€” Verify installation

openclaw --version
# openclaw/x.x.x linux-arm64 node-v22.x.x

Configure Your Agent

OpenClaw is configured via a JSON file at ~/.openclaw/config.json. Create it with your API keys and preferred model.

Minimal config โ€” Claude Sonnet via Anthropic

{
  "model": "anthropic/claude-sonnet-4-6",
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-YOUR_KEY_HERE"
    }
  },
  "gateway": {
    "bind": "127.0.0.1:3000"
  }
}

Budget config โ€” Gemini Flash (cheapest option)

{
  "model": "google/gemini-flash-2.5",
  "providers": {
    "google": {
      "apiKey": "YOUR_GOOGLE_AI_KEY"
    }
  },
  "gateway": {
    "bind": "127.0.0.1:3000"
  }
}
โš ๏ธ

Never bind to 0.0.0.0 without a firewall

Keep gateway.bind set to 127.0.0.1:3000 (localhost only). Access OpenClaw through Telegram or SSH tunnel โ€” not by exposing port 3000 to the internet.

Connect Telegram

Telegram is the fastest way to talk to your VPS-hosted agent from anywhere. You'll need a bot token from @BotFather and your Telegram user ID.

Add Telegram to your config

{
  "model": "anthropic/claude-sonnet-4-6",
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-YOUR_KEY_HERE"
    }
  },
  "gateway": {
    "bind": "127.0.0.1:3000"
  },
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": true,
        "config": {
          "token": "YOUR_BOT_TOKEN",
          "allowedUsers": [YOUR_TELEGRAM_USER_ID]
        }
      }
    }
  }
}

Start the gateway and test

openclaw gateway start

# Check it's running
openclaw gateway status

Message your bot on Telegram. If it responds, your VPS setup is working. If not, check openclaw gateway logs for errors.

๐Ÿ“–

Full Telegram setup guide

Need help creating a Telegram bot, finding your user ID, or setting up multi-bot configs? Read the complete Telegram setup tutorial โ†’

Keep It Running 24/7

By default, openclaw gateway start runs in the foreground. If you close your SSH session, the gateway stops. You have two good options for persistence: systemd (recommended) or PM2.

Option A โ€” systemd service (recommended)

# Create the service file
cat > /etc/systemd/system/openclaw.service << 'EOF'
[Unit]
Description=OpenClaw Gateway
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root
ExecStart=/usr/bin/openclaw gateway start
Restart=always
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
EOF

# Enable and start
systemctl daemon-reload
systemctl enable openclaw
systemctl start openclaw

# Check status
systemctl status openclaw

Option B โ€” PM2 (simpler, more flexible)

npm install -g pm2

pm2 start "openclaw gateway start" --name openclaw
pm2 startup   # generates the command to auto-start on boot
pm2 save      # saves process list

# Check logs anytime
pm2 logs openclaw

Test your persistence

After setting up systemd or PM2, reboot your droplet (reboot), wait 30 seconds, and message your Telegram bot. If it responds, you're fully persistent.

Basic Security Hardening

A VPS with root access and a public IP needs basic hardening. This takes 5 minutes and blocks 99% of automated attacks.

1. Set up UFW firewall

# Allow SSH and close everything else
ufw allow OpenSSH
ufw enable

# Verify โ€” should show SSH allowed, port 3000 NOT exposed
ufw status

2. Disable password SSH login (if using SSH keys)

# Edit SSH config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl restart sshd

3. Enable automatic security updates

apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
# Select "Yes" when prompted

Security checklist

UFW firewall enabled โ€” port 3000 is NOT open to the internet
SSH key authentication only (no passwords)
Automatic security updates enabled
OpenClaw gateway bound to 127.0.0.1, not 0.0.0.0
Telegram bot restricted to your user ID only

Next Steps

Your VPS-hosted OpenClaw is now running 24/7 and reachable via Telegram. Here's what to do next:

Your AI Agent, Always On

A VPS-hosted OpenClaw responds to Telegram 24/7, runs your cron jobs, and never misses a beat. You've already done the hard part.

Related Articles

We use cookies for analytics. Learn more
Run your own AI agent for $6/month โ†’