← back to home

How to Deploy OpenClaw on VPS: Complete Guide (2026)

February 21, 2026 · 15 min read
TL;DR: Step-by-step guide to deploy OpenClaw on any VPS (DigitalOcean, Linode, Hetzner). Covers Ubuntu setup, security hardening, Telegram integration, and common troubleshooting. Takes 1-2 hours.

What You'll Need

Cost: $5-10/month for VPS + API usage

Time: 1-2 hours (first time), 30 min (if you know what you're doing)

Why Deploy on Your Own VPS?

Benefits:

Drawbacks:

Step 1: Create Your VPS (10 minutes)

DigitalOcean (Recommended for Beginners)

  1. Go to digitalocean.com and create account
  2. Click "Create Droplet"
  3. Choose Ubuntu 22.04 LTS
  4. Select "Basic" plan
  5. Pick $6/month option (1 GB RAM, 1 vCPU—enough for OpenClaw)
  6. Choose region closest to you
  7. Add SSH key (or use password—we'll secure it later)
  8. Click "Create Droplet"

Alternative providers:

All providers work the same. Pick whichever you prefer.

Step 2: Connect to Your VPS (5 minutes)

On Mac/Linux:

ssh root@your-vps-ip

On Windows:

Use PuTTY or Windows Terminal with WSL.

You'll see something like:

Welcome to Ubuntu 22.04 LTS
root@openclaw:~#

You're in. Now we install OpenClaw.

Step 3: Install Node.js (5 minutes)

OpenClaw runs on Node.js. Install it:

# Update package list
apt update && apt upgrade -y

# Install Node.js 20.x (LTS)
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

# Verify installation
node --version   # Should show v20.x.x
npm --version    # Should show 10.x.x

Why Node 20? OpenClaw requires Node 18+ for modern JavaScript features.

Step 4: Install OpenClaw (7 minutes)

# Clone OpenClaw repository
git clone https://github.com/openclaw/openclaw.git
cd openclaw

# Install dependencies
npm install

# Build the project
npm run build

This takes 3-5 minutes. You'll see a bunch of package names scroll by. That's normal.

If you see errors: Check Node version. Needs to be 18+.

Step 5: Configure OpenClaw (10 minutes)

# Copy example config
cp config.example.json config.json

# Edit with nano (or vim if you prefer)
nano config.json

Key settings to change:

{
  "gateway": {
    "host": "localhost",    // IMPORTANT: localhost only for security
    "port": 3000
  },
  "telegram": {
    "botToken": "YOUR_BOT_TOKEN_HERE"  // Get from @BotFather
  },
  "ai": {
    "provider": "nvidia",               // Free Kimi via Nvidia
    "apiKey": "nvapi-...",             // Your Nvidia API key
    "model": "kimi-k2.5"
  }
}

Security note: Always set host: "localhost". Never expose to 0.0.0.0 without authentication.

Save with: Ctrl+X, then Y, then Enter

Step 6: Get Your Telegram Bot Token (10 minutes)

  1. Open Telegram, search for @BotFather
  2. Send /newbot
  3. Choose a name: "My OpenClaw Bot"
  4. Choose a username: "myopenclaw_bot" (must end in _bot)
  5. Copy the token (looks like: 1234567890:ABCdefGHIjklMNOpqrsTUVwxyz)
  6. Paste it in config.json under telegram.botToken

Step 7: Get Free AI Credits (Kimi via Nvidia) (10 minutes)

Why Kimi? 50,000 free tokens/day. No credit card required.

  1. Go to build.nvidia.com/moonshot
  2. Sign up with email
  3. Click "Get API Key"
  4. Copy the key (starts with nvapi-...)
  5. Paste in config.json under ai.apiKey

Alternative: Use Claude or GPT

Step 8: Start OpenClaw (2 minutes)

# Start in foreground (to test)
npm start

You should see:

[gateway] gateway listening on localhost:3000
[telegram] starting provider
[telegram] bot connected: @your_bot_name

Test it: Message your bot on Telegram. It should reply.

If it works, press Ctrl+C to stop. We'll make it run 24/7 next.

Step 9: Make It Run 24/7 with PM2 (5 minutes)

# Install PM2 (process manager)
npm install -g pm2

# Start OpenClaw with PM2
pm2 start npm --name "openclaw" -- start

# Make it start on boot
pm2 startup
pm2 save

Useful PM2 commands:

pm2 status          # Check if running
pm2 logs openclaw   # View logs
pm2 restart openclaw  # Restart
pm2 stop openclaw   # Stop

Step 10: Security Hardening (10 minutes)

CRITICAL: Don't skip this step.

10.1: Set Up Firewall (UFW)

# Install UFW
apt install ufw

# Default rules: deny incoming, allow outgoing
ufw default deny incoming
ufw default allow outgoing

# Allow SSH (otherwise you'll lock yourself out)
ufw allow 22/tcp

# Enable firewall
ufw enable

# Check status
ufw status

10.2: Install fail2ban (Blocks Brute Force)

apt install fail2ban
systemctl enable fail2ban
systemctl start fail2ban

10.3: Create Non-Root User

# Create user
useradd -m openclaw

# Add to sudo group
usermod -aG sudo openclaw

# Switch to this user for running OpenClaw
su - openclaw

Why? Running as root is dangerous. If OpenClaw gets compromised, attacker has full system access.

Step 11: Verify Everything Works (5 minutes)

Checklist:

Test: Message your Telegram bot. Should reply instantly.

Common Issues & Fixes

"Bot not responding"

# Check if OpenClaw is running
pm2 status

# Check logs for errors
pm2 logs openclaw

# Verify Telegram token
curl https://api.telegram.org/bot<YOUR_TOKEN>/getMe

"API key invalid"

"Gateway connection refused"

# Check if port 3000 is listening
netstat -tlnp | grep 3000

# Restart OpenClaw
pm2 restart openclaw

"npm install" fails

Maintenance Tips

Weekly:

Monthly:

Check disk space:

df -h

If / is above 80%, clean logs:

pm2 flush openclaw

Upgrading to Paid AI Models

Free Kimi is great to start, but has limits (50k tokens/day).

When you need more:

Add Claude API

  1. Get key from console.anthropic.com
  2. Update config.json:
"ai": {
  "provider": "anthropic",
  "apiKey": "sk-ant-...",
  "model": "claude-opus-4.5"
}
  1. Restart: pm2 restart openclaw

Switch to GPT

"ai": {
  "provider": "openai",
  "apiKey": "sk-proj-...",
  "model": "gpt-5.2"
}

Next Steps

Your OpenClaw is running. Now what?

  1. Add more channels: Discord, Email, WhatsApp
  2. Enable browser automation: Let it browse the web
  3. Set up web search: Connect to Google/Bing API
  4. Create custom skills: Teach it new abilities
  5. Backup config: cp config.json config.backup.json

When Manual Setup Isn't Worth It

If this guide feels overwhelming, or you don't want to maintain a VPS yourself, consider the managed option.

5-minute automated deploy: open-claw.space

Most people do manual setup once to learn how it works, then realize maintaining it isn't worth their time.

Resources


Last updated: February 2026