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.
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:
| Provider | Cheapest Plan | RAM | Best For |
|---|---|---|---|
| โญ DigitalOcean | $6/mo | 1 GB | Easiest setup, great docs, free $200 credit for new users |
| ๐ฐ Contabo | ~$5.50/mo | 4 GB | Best raw value โ 4ร the RAM for less money. German infrastructure. |
| Hetzner | โฌ4/mo (~$4.50) | 2 GB | Best value in Europe. 2x RAM for less money |
| Vultr | $6/mo | 1 GB | Global locations, reliable performance |
| Linode (Akamai) | $5/mo | 1 GB | Solid 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:
Choose Region
Pick the region closest to you for the lowest latency. NYC, Frankfurt, or Singapore are popular choices.
Choose Image
Ubuntu 22.04 LTS (x64). Node.js requires Ubuntu 20.04+ โ 22.04 is rock-solid.
Choose Size
Basic Shared CPU โ Regular โ 1 GB / 1 vCPU / 25 GB SSD = $6/month. This is enough for OpenClaw.
Add SSH Key
Upload your public SSH key (~/.ssh/id_rsa.pub) or generate one in the DigitalOcean dashboard. Password auth is less secure.
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_IPInstall OpenClaw
OpenClaw requires Node.js 20+. Start by updating your server and installing the dependencies:
Step 1 โ Update the system
apt update && apt upgrade -yStep 2 โ Install Node.js 22 via NodeSource
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejsStep 3 โ Verify Node version
node --version
# Should print v22.x.x or higherStep 4 โ Install OpenClaw globally
npm install -g openclawStep 5 โ Verify installation
openclaw --version
# openclaw/x.x.x linux-arm64 node-v22.x.xConfigure 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 statusMessage 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 openclawOption 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 openclawTest 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 status2. Disable password SSH login (if using SSH keys)
# Edit SSH config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl restart sshd3. Enable automatic security updates
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
# Select "Yes" when promptedSecurity checklist
Next Steps
Your VPS-hosted OpenClaw is now running 24/7 and reachable via Telegram. Here's what to do next:
Set Up Cron Jobs
Schedule your agent to send morning briefings, monitor prices, or run automations on a timer.
Configure Memory
Set up MEMORY.md so your agent remembers your preferences, projects, and context across every session.
Install Skills
Add skills for email, calendar, GitHub, WhatsApp, and more. Each skill is a reusable instruction set for your agent.
Try Automations
15 practical automations you can set up this weekend โ from crypto price alerts to auto-deploy pipelines.
โ๏ธ DigitalOcean โ
$6/mo droplet. $200 free credit for new users. Easiest setup.
๐ฉ๐ช Contabo โ
4GB RAM for ~$5.50/mo. Best value VPS on the market.
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.