GuideFebruary 2, 2026

How to Run Claude Code on VPS with OpenClaw: Complete Setup Guide

Step-by-step guide to running Claude Code on a VPS using OpenClaw. Connect to WhatsApp, Telegram, Discord and more.

How to Run Claude Code on VPS with OpenClaw

OpenClaw enables you to run Claude Code on any VPS and connect it to messaging platforms. Here's the complete setup guide.

Prerequisites

  • VPS with Ubuntu 22.04+
  • 2GB RAM minimum
  • Anthropic API key
  • Node.js 18+

Step 1: VPS Setup

bash

# Update system

sudo apt update && sudo apt upgrade -y

# Install Node.js

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

sudo apt install -y nodejs

# Install PM2 for process management

npm install -g pm2



Step 2: Install OpenClaw

bash

# Clone repository

git clone https://github.com/openclaw/openclaw.git

cd openclaw

# Install dependencies

npm install

# Create config

cp .env.example .env



Step 3: Configure Environment

Edit your `.env` file:


ANTHROPIC_API_KEY=your_key_here

CLAUDE_MODEL=claude-sonnet-4-5

MAX_TOKENS=4096



Step 4: Platform Integrations

WhatsApp

bash

# Install WhatsApp adapter

npm install @openclaw/whatsapp-adapter

# Configure in config.yaml

platforms:

whatsapp:

enabled: true

phone_id: your_phone_id



Telegram

bash

# Install Telegram adapter

npm install @openclaw/telegram-adapter

# Configure

platforms:

telegram:

enabled: true

bot_token: your_bot_token



Discord

bash

# Install Discord adapter

npm install @openclaw/discord-adapter

# Configure

platforms:

discord:

enabled: true

bot_token: your_discord_token



Step 5: Run with PM2

bash

# Start OpenClaw

pm2 start npm --name "openclaw" -- start

# Enable auto-restart

pm2 startup

pm2 save



Step 6: Verify Installation

bash

# Check status

pm2 status

# View logs

pm2 logs openclaw



Security Best Practices

1. Use environment variables for secrets

2. Enable firewall (UFW)

3. Regular security updates

4. Monitor API usage

Troubleshooting

Connection Issues:
  • Check API key validity
  • Verify network connectivity
  • Review firewall rules
Performance Issues:
  • Increase VPS resources
  • Optimize max_tokens setting
  • Enable response caching

Cost Considerations

  • VPS: $5-20/month
  • Claude API: Usage-based
  • Typical usage: $10-50/month total

Conclusion

OpenClaw provides an efficient way to run Claude Code across multiple platforms. Follow this guide for a production-ready setup.

Ready to Experience Claude 5?

Try Now