Table of Contents

  1. What is OpenClaw?
  2. Prerequisites
  3. Option A: Google Cloud Free Tier (FREE)
  4. Option B: Hostinger VPS (Paid - $5/month)
  5. Post-Installation: Configure OpenClaw
  6. Making OpenClaw Run Forever with PM2
  7. Telegram Setup & Pairing
  8. WhatsApp Setup (Optional)
  9. Troubleshooting
  10. Quick Reference Commands

What is OpenClaw?

OpenClaw (formerly Moltbot/Clawdbot) is an AI-powered automation agent that connects to messaging platforms like Telegram, WhatsApp, Slack, and more. Once set up on a cloud server, it runs 24/7, responding to your messages and executing tasks even when you're asleep.

Why run it on a server instead of your Mac/PC?

  • Runs 24/7 without keeping your computer on
  • No battery drain or fan noise
  • Accessible from anywhere
  • More reliable than local setups

Prerequisites

Before starting, you'll need:

  1. A Telegram Bot Token — Get one from @BotFather on Telegram
  2. An AI API Key — Either:
  3. A cloud server — Google Cloud (free) or Hostinger VPS ($5/month)

Option A: Google Cloud Free Tier (FREE)

Google Cloud offers an always-free e2-micro instance that's perfect for running OpenClaw.

Step 1: Create Google Cloud Account

  1. Go to cloud.google.com
  2. Click "Get started for free"
  3. Sign in with your Google account
  4. Enter billing information (you get $300 free credits + always-free tier)
  5. Complete the setup wizard

Step 2: Create a Virtual Machine

  1. In the Google Cloud Console, click the hamburger menu (☰) in the top-left
  2. Navigate to Compute EngineVM instances
  3. Click "Create Instance"
  4. Configure your VM: Name: openclaw-server Region: Choose one of these FREE regions:Machine type: e2-micro (this is the FREE tier!) Boot disk: Click "Change"
    • us-west1 (Oregon)
    • us-central1 (Iowa)
    • us-east1 (South Carolina)
    • Operating system: Ubuntu
    • Version: Ubuntu 22.04 LTS or Ubuntu 24.04 LTS
    • Size: 30 GB (free tier allows up to 30GB)
  5. Under Firewall, check:
    • ✅ Allow HTTP traffic
    • ✅ Allow HTTPS traffic
  6. Click "Create"

Wait 1-2 minutes for your VM to spin up.

Step 3: Connect to Your Server

  1. Find your new VM in the list
  2. Click the "SSH" button (opens a browser terminal)
  3. You're now connected to your server!

Continue to Post-Installation: Configure OpenClaw


Option B: Hostinger VPS (Paid)

Hostinger offers affordable VPS hosting with better performance than free tiers.

Step 1: Purchase a VPS

  1. Go to hostinger.com/vps-hosting
  2. Choose KVM 1 plan (cheapest, sufficient for OpenClaw)
  3. Select Ubuntu 24.04 as your operating system
  4. Complete checkout

You'll receive an email with your server IP and root password.

Step 2: Connect to Your Server

On Mac/Linux:

ssh root@YOUR_SERVER_IP

On Windows: Use PuTTY or Windows Terminal.

Continue to Post-Installation: Configure OpenClaw


Post-Installation: Configure OpenClaw

Once connected to your server via SSH, follow these steps:

Step 1: Update System & Install Dependencies

# Update system packages
sudo apt update && sudo apt upgrade -y

# Install git (required for npm packages)
sudo apt install -y git

# Install Node.js 22.x
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs

# Verify installation
node --version
npm --version

Step 2: Create a Dedicated User for OpenClaw

# Create user (as root)
sudo adduser openclaw --disabled-password --gecos ""

# Switch to the new user
sudo su - openclaw

Step 3: Install OpenClaw

# Set up npm global directory
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Install OpenClaw globally
npm install -g openclaw

# Verify installation
openclaw --version

Step 4: Initialize OpenClaw

openclaw setup

Step 5: Configure OpenClaw

Run the configuration wizard:

openclaw configure

Important settings to configure:

  1. Gateway Location: Select "Local (this machine)"
  2. Sections to configure: Select these:
    • ✅ Gateway
    • ✅ Model
    • ✅ Channels
  3. Gateway settings:
    • Port: 18789 (default)
    • Bind mode: Loopback (Local only)
    • Auth: Token (Recommended)
    • Tailscale: Off
  4. Model settings:
    • Provider: Anthropic (recommended) or OpenRouter
    • Enter your API key when prompted
    • Important: Make sure to select an actual model like anthropic/claude-sonnet-4-20250514 as default (NOT openrouter/auto)
  5. Channels:
    • Select Telegram (Bot API)
    • Enter your Telegram Bot Token from @BotFather
    • DM Policy: pairing (recommended for security)
  6. Continue to finish configuration

Making OpenClaw Run Forever with PM2

PM2 keeps OpenClaw running 24/7, even after you close SSH.

Step 1: Install PM2

# Exit to root user first
exit

# Install PM2 globally
sudo npm install -g pm2

# Switch back to openclaw user
sudo su - openclaw

Step 2: Start OpenClaw with PM2

Important: The command is openclaw gateway, NOT openclaw start!

pm2 start "openclaw gateway" --name openclaw
pm2 save

Step 3: Configure Auto-Start on Reboot

pm2 startup

PM2 will output a command. Copy that command and run it as root:

# Exit to root
exit

# Run the command PM2 gave you (example):
sudo env PATH=$PATH:/usr/bin /home/openclaw/.npm-global/lib/node_modules/pm2/bin/pm2 startup systemd -u openclaw --hp /home/openclaw

# Switch back to openclaw
sudo su - openclaw

# Save the process list
pm2 save

Step 4: Verify OpenClaw is Running

pm2 status
pm2 logs openclaw --lines 20

You should see:

  • Status: online
  • Logs showing: [gateway] listening on ws://127.0.0.1:18789
  • Logs showing: [telegram] starting provider

Telegram Setup & Pairing

Step 1: Message Your Bot

Open Telegram and send any message to your bot (the one you created with @BotFather).

Step 2: Approve Your Account

You'll receive a message like:

OpenClaw: access not configured.
Your Telegram user id: 1234567890
Pairing code: ABC123XY
Ask the bot owner to approve with:
openclaw pairing approve telegram <code>

Step 3: Run the Approval Command

In your SSH terminal:

bash

openclaw pairing approve telegram ABC123XY

Replace ABC123XY with your actual pairing code.

Step 4: Test the Bot

Send another message to your Telegram bot. It should now respond!


WhatsApp Setup (Optional)

WhatsApp integration works differently from Telegram. Instead of creating a separate bot, OpenClaw connects to YOUR personal WhatsApp account via WhatsApp Web.

Important: After setup, when someone messages your WhatsApp number, OpenClaw can see and respond to those messages.

Prerequisites for WhatsApp

  • WhatsApp installed on your phone
  • Your phone connected to the internet
  • Available linked device slot (WhatsApp allows limited linked devices)

Step 1: Configure WhatsApp Channel

openclaw configure
  1. Select Channels when prompted
  2. Choose WhatsApp from the channel list
  3. Set DM Policy to pairing (recommended for security)
  4. Continue to finish

Run this command to display the QR code:

openclaw channels login whatsapp --verbose

You'll see a QR code displayed in your terminal.

Step 3: Scan the QR Code

  1. Open WhatsApp on your phone
  2. Go to SettingsLinked Devices
  3. Tap Link a Device
  4. Scan the QR code shown in your terminal

Step 4: Restart OpenClaw

pm2 restart openclaw

Step 5: Verify WhatsApp is Connected

pm2 logs openclaw --lines 20

Look for: [whatsapp] starting provider in the logs.

You can also check status with:

openclaw status

Step 6: Test WhatsApp

Option A: Ask a friend to message your WhatsApp number

Option B: Message yourself:

  1. Save your own phone number as a contact
  2. Open WhatsApp and start a chat with yourself
  3. Send a message — OpenClaw should respond

WhatsApp Access Control

Since OpenClaw uses your personal WhatsApp, you'll want to control who it responds to.

Set up pairing (recommended):

When someone new messages you, they'll receive a pairing code. Approve them with:

openclaw pairing approve whatsapp <CODE>

Check pending requests:

openclaw pairing list whatsapp

WhatsApp Troubleshooting

QR code not showing:

openclaw channels login whatsapp --verbose

WhatsApp disconnected: Your phone may have gone offline. Re-scan the QR code:

openclaw channels login whatsapp --verbose

Check WhatsApp status:

openclaw status

Phone requirement: Unlike Telegram bots, WhatsApp Web requires your phone to stay connected to the internet. If your phone loses connection for too long, you may need to re-link.


Troubleshooting

Error: "unknown command 'start'"

Cause: Using wrong command Solution: Use openclaw gateway instead of openclaw start

pm2 delete openclaw
pm2 start "openclaw gateway" --name openclaw
pm2 save

Error: "Gateway start blocked: set gateway.mode=local"

Cause: Gateway mode not configured Solution: Set it manually:

pm2 stop openclaw
openclaw config set gateway.mode local
pm2 restart openclaw

Or run openclaw configure and select "Gateway" section.

Error: "Unknown model: openrouter/auto"

Cause: Invalid default model selected Solution: Set a valid model:

pm2 stop openclaw

# Edit the config file
cat ~/.openclaw/openclaw.json | grep -A5 "model"

# Use sed to replace the model (example for Anthropic):
sed -i 's/"primary": "openrouter\/auto"/"primary": "anthropic\/claude-sonnet-4-20250514"/' ~/.openclaw/openclaw.json

pm2 restart openclaw

Or run openclaw configure → Model → select Anthropic and a specific model.

Error: "No API key found for provider"

Cause: API key not configured Solution: Run configure and add your API key:

openclaw configure

Select "Model" and enter your Anthropic or OpenRouter API key.

Error: "All models failed... rate_limit"

Cause: API key is rate limited or invalid Solution:

  1. Check your API key is valid at console.anthropic.com
  2. Regenerate the key if needed
  3. Update in OpenClaw:
openclaw configure
# Select Model → Anthropic → Enter new API key
pm2 restart openclaw

Error: "No pending pairing request found"

Cause: Pairing code expired Solution:

  1. Message your Telegram bot again to get a new code
  2. Run the approve command with the new code within 5 minutes

Error: "npm error syscall spawn git"

Cause: Git not installed Solution:

sudo apt install -y git

Error: "EACCES permission denied"

Cause: Running npm without sudo for global packages Solution:

sudo npm install -g <package>

OpenClaw stops when I close SSH

Cause: PM2 not set up correctly Solution: Follow the PM2 setup section completely, including pm2 startup and pm2 save.

How to check if OpenClaw is running

pm2 status
pm2 logs openclaw --lines 20

How to restart OpenClaw

pm2 restart openclaw

How to view all logs

pm2 logs openclaw --lines 100
# or
cat /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log

Quick Reference Commands

Server Connection

# Google Cloud
gcloud compute ssh openclaw-server

# Hostinger/Direct SSH
ssh root@YOUR_SERVER_IP
sudo su - openclaw

PM2 Commands

pm2 status                # Check if running
pm2 logs openclaw         # View live logs
pm2 restart openclaw      # Restart
pm2 stop openclaw         # Stop
pm2 delete openclaw       # Remove from PM2
pm2 save                  # Save process list

OpenClaw Commands

openclaw --version       # Check version
openclaw configure       # Run configuration wizard
openclaw models          # View model configuration
openclaw status          # Check channel health
openclaw logs --follow   # View gateway logs
openclaw pairing approve telegram <CODE>   # Approve Telegram user
openclaw pairing approve whatsapp <CODE>   # Approve WhatsApp user
openclaw pairing list telegram             # List pending Telegram requests
openclaw pairing list whatsapp             # List pending WhatsApp requests
openclaw channels login whatsapp --verbose # Link WhatsApp (show QR code)

User Switching

sudo su - openclaw        # Switch to openclaw user
exit                      # Switch back to previous user
whoami                    # Check current user

What's Next?

Now that OpenClaw is running 24/7:

  1. Connect more platforms — WhatsApp, Slack, Discord, etc.
  2. Customize your bot — Set up skills and automations
  3. Explore the dashboard — Run openclaw dashboard to access the web UI

For more information, visit the official documentation at docs.openclaw.ai


Created by The AI Driven Marketer