You’ve probably seen OpenClaw all over Twitter and Reddit lately. It’s the self-hosted AI assistant that lets you message WhatsApp or Telegram and have it create blog posts, run automations, search the web, or manage tasks — all on your own server, with your own API keys. No monthly subscription to some SaaS wrapper. Just your VPS, your data, and whatever AI model you connect.
The install is actually straightforward. One curl command handles most of it. But running it on a VPS — so it stays online 24/7, connected to WhatsApp, actually secure — that part has a few extra steps people skip and then complain about later.
This guide covers the complete setup: getting a free VPS, installing OpenClaw, starting the gateway as a systemd service, connecting a messaging channel, and locking it down properly. By the end you’ll have a running AI assistant that you can message from your phone at any time.
What Is OpenClaw and Why Run It on a VPS
OpenClaw (previously known as Moltbot / Clawdbot) is an open-source, self-hosted AI assistant gateway. You install it on a server, connect it to AI models like Claude or GPT-4, and then interact with it through messaging apps — WhatsApp, Telegram, Slack, Discord — like you’re texting an assistant who can actually do things.
| Component | What It Is | What It Does |
|---|---|---|
| Gateway | Node.js process on your VPS | Receives messages, routes them to AI models, manages sessions |
| Control UI | Web dashboard at port 18789 | Configure agents, channels, models, plugins |
| Channels | WhatsApp, Telegram, Slack, Discord | How you interact with your AI assistant |
| Agents | AI model + instructions + tools | The actual brains — runs tasks, web search, file ops |
Why run it on a VPS instead of your laptop? Because your laptop sleeps. A VPS doesn’t. The gateway needs to stay running 24/7 to receive messages, maintain conversation context, and process scheduled tasks. Run it on your local machine and your AI assistant goes offline whenever you close the lid.
The other reason is privacy. OpenClaw stores all session history and conversation memory on your own server. Nothing goes to third parties beyond what the AI model API processes to generate a response. If you go full local with Ollama, even that stays on your machine.
What You Need Before You Start
- A VPS running Ubuntu 22.04 or 24.04 — minimum 2 GB RAM, 1–2 vCPU, 10 GB storage
- Root or sudo SSH access
- An API key from Anthropic, OpenAI, or another supported provider
- A WhatsApp or Telegram account for the channel you want to connect
- About 15–20 minutes
The official OpenClaw docs say 1 GB RAM is enough. In practice it’s not — the install itself can fail with memory errors on 1 GB machines, especially when browsing automation tools are active. Stick to 2 GB minimum. 4 GB is comfortable if you want to run multiple agents or tools simultaneously.
Step 1 — Get a VPS
You need a publicly reachable VPS with a real IP address. VPSWala’s free VPS gets you Ubuntu 22.04 or 24.04, root access, a public IP, and no credit card. The free Starter plan runs on Ampere ARM64 with 2 GB RAM — enough to run OpenClaw with light traffic and a single agent. For heavier workloads, multiple agents, or running Ollama locally alongside OpenClaw, the 30-day Professional free trial gives you 8-core AMD EPYC with 8 GB DDR5 ECC RAM — more than enough headroom.
Once your VPS is provisioned, SSH in:
ssh root@YOUR_VPS_IP
Not used SSH before? Check our SSH tips and tricks guide — covers key-based auth, tmux, and keeping sessions alive.
Step 2 — Update the Server
Do this on every fresh VPS before installing anything:
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget unzip git
Takes 1–2 minutes. Don’t skip it — stale package indexes cause mysterious install failures that are annoying to debug later.
Step 3 — Install OpenClaw
OpenClaw provides an installer script that handles everything: detects your OS, installs Node.js 24 if it’s not already there, installs the OpenClaw CLI globally, and launches the onboarding wizard.
curl -fsSL https://openclaw.ai/install.sh | bash
The onboarding wizard is a text-based UI that walks you through the initial configuration — API key, gateway token, channel setup. Read the prompts before hitting enter. Don’t rush through it.
If you want to install without running onboarding (useful for scripted or CI setups):
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
After the script finishes, verify the install:
openclaw --version # confirms the CLI is installed
openclaw doctor # checks for config issues
openclaw gateway status # checks if the gateway is running
If you get openclaw: command not found after install, the global npm bin directory isn’t in your PATH. Fix it:
echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Then run openclaw --version again.
Step 4 — Start the Gateway
The gateway is the core process — it listens for incoming messages, maintains conversation context, and routes everything to the right agent. It installs as a systemd service automatically during onboarding, so on most setups it’ll already be running.
Check its status:
openclaw gateway status
The output shows whether it’s running, the dashboard URL, port (default 18789), bind address, and where config files live. You want to see it running and listening on 127.0.0.1:18789 — loopback only by default, which is the secure way to run it.
If it’s not running, start it:
openclaw gateway start
To restart after config changes:
openclaw gateway restart
Step 5 — Access the Dashboard
The dashboard runs at http://127.0.0.1:18789 on the VPS — loopback only, not accessible from the internet directly. That’s intentional and correct. You access it through an SSH tunnel from your local machine (covered in Step 9).
For a quick check during initial setup, you can temporarily access it directly from the VPS if you’re comfortable with that. The dashboard lets you configure agents, connect channels, add AI model API keys, install plugins, and monitor activity.
Step 6 — Connect WhatsApp or Telegram
In the dashboard, go to Channels. This is where you link your messaging app to OpenClaw.
Click Show QR next to WhatsApp in the Channels section. On your phone, open WhatsApp → Settings → Linked Devices → Link a Device. Scan the QR code. The connection persists across gateway restarts — you don’t have to scan again unless the session expires.
Telegram
For Telegram you need a bot token. Go to @BotFather on Telegram, run /newbot, follow the prompts, and copy the token. Paste it into the Telegram channel config in the OpenClaw dashboard. Done.
| Channel | Setup Method | What You Need |
|---|---|---|
| QR code scan (linked device) | Your existing WhatsApp account | |
| Telegram | Bot token from @BotFather | Telegram account + 2 minutes |
| Slack | OAuth app install | Slack workspace admin access |
| Discord | Bot token from Discord Developer Portal | Discord account |
Step 7 — Connect an AI Model
OpenClaw doesn’t include an AI model — it connects to one. In the dashboard go to Models and add your provider.
For Anthropic Claude, add your API key from console.anthropic.com. For OpenAI, grab the key from platform.openai.com. Both work. Claude tends to handle longer context and complex instructions better; GPT-4o is solid for general use.
If you want complete privacy — no data leaving your VPS at all — install Ollama on the same server and point OpenClaw at it. Ollama runs open models like Llama 3, Mistral, or Gemma locally. You’ll need a VPS with at least 8 GB RAM for this to work well, so grab the Professional trial if you want to go that route.
Step 8 — Secure with UFW Firewall
The gateway by default only binds to loopback (127.0.0.1), so port 18789 isn’t publicly exposed. But you still want a firewall in place for the rest of the server.
# Allow SSH first — do this before enabling the firewall or you'll lock yourself out
sudo ufw allow OpenSSH
# Enable the firewall
sudo ufw enable
# Verify
sudo ufw status
You should not open port 18789 publicly. Access the dashboard through an SSH tunnel instead (Step 9). If you ever need to allow the dashboard from a specific IP only:
# Only if you specifically need remote dashboard access from a known IP
sudo ufw allow from YOUR.IP.ADDRESS to any port 18789
For the full firewall setup guide, see our post on how to configure UFW on a VPS. For a broader hardening walkthrough, our VPS security guide covers SSH hardening, fail2ban, and more.
Step 9 — Access Dashboard Safely via SSH Tunnel
Since the dashboard binds to loopback only, you access it by forwarding the port over SSH to your local machine. Run this on your local machine (not the VPS):
ssh -L 18789:127.0.0.1:18789 root@YOUR_VPS_IP -N
Then open http://localhost:18789 in your browser. The tunnel forwards your local port 18789 to the gateway on the VPS. Works on Mac, Linux, and Windows (PowerShell or Git Bash).
Add -f to run it in the background:
ssh -fNL 18789:127.0.0.1:18789 root@YOUR_VPS_IP
If you’re using Tailscale, you can use Tailscale Serve instead and skip the manual tunnel entirely — the OpenClaw docs cover this at docs.openclaw.ai/gateway/remote.
Step 10 — Tune systemd for Reliability
The installer sets up a systemd service for the gateway. On small VMs or ARM hosts, a couple of extra tweaks make startup more reliable and speed up CLI commands:
sudo systemctl edit openclaw
This opens a drop-in override file. Add:
[Service]
Environment=OPENCLAW_NO_RESPAWN=1
Environment=NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache
Restart=always
RestartSec=2
TimeoutStartSec=90
Save and apply:
sudo systemctl daemon-reload
sudo systemctl restart openclaw
Also add the compile cache to your shell startup so CLI commands feel faster:
grep -q 'NODE_COMPILE_CACHE' ~/.bashrc || cat >> ~/.bashrc <<'EOF'
export NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache
mkdir -p /var/tmp/openclaw-compile-cache
export OPENCLAW_NO_RESPAWN=1
EOF
source ~/.bashrc
OPENCLAW_NO_RESPAWN=1 cuts a self-respawn step on startup. NODE_COMPILE_CACHE caches compiled Node modules so repeat commands run noticeably faster. On the first run it warms the cache — after that it’s quick.
Verify the gateway is running correctly after the restart:
openclaw gateway status
sudo systemctl status openclaw
Step 11 — Keep OpenClaw Updated
OpenClaw releases frequently. To update the CLI:
npm update -g openclaw
sudo systemctl restart openclaw
Check the GitHub releases page before upgrading on a production instance — the changelog will flag any breaking changes. Conversation history and memory stored locally live in ~/.openclaw/data. Back that directory up periodically:
# Add to crontab (crontab -e) for nightly backup
0 3 * * * rsync -az ~/.openclaw/data/ /backup/openclaw-data/
Your config and custom skills live in the config file — back that up too or version it in Git. For general VPS backup strategies, see our guide on automated VPS backups.
Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
openclaw: command not found |
Global npm bin not in PATH | echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc |
| Install fails with memory errors | VPS has less than 2 GB RAM | Upgrade to at least 2 GB RAM — the free Starter plan on VPSWala includes 2 GB |
| Gateway won’t start | Missing env variables or port conflict | journalctl -u openclaw -n 50 — check for missing API key or another process on port 18789 |
| Dashboard not loading on localhost:18789 | SSH tunnel not active or gateway not running | Run openclaw gateway status on VPS — confirm it’s running, then reopen the SSH tunnel |
| WhatsApp disconnects frequently | Gateway restarting or session expiring | Check sudo systemctl status openclaw for crash loops — add the systemd restart tuning from Step 10 |
| Telegram bot not responding | Wrong bot token or webhook issue | Verify the token in dashboard Channels — regenerate from @BotFather if needed |
| CLI commands are very slow | Node module compile cache not enabled | Add NODE_COMPILE_CACHE and OPENCLAW_NO_RESPAWN=1 to ~/.bashrc as in Step 10 |
| sharp build errors during install (npm) | Conflicting global libvips | SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest |
That’s it — OpenClaw is running on your VPS, the gateway is online 24/7 as a systemd service, your messaging channel is connected, and the dashboard is accessible safely through an SSH tunnel. Send a message from WhatsApp or Telegram and your AI assistant responds. Everything runs on your infrastructure, your API keys, your data.
For heavier workloads — multiple agents, local Ollama models, or team setups where multiple people share one gateway — the VPSWala Professional free trial gives you 8-core AMD EPYC and 8 GB DDR5 ECC RAM for 30 days, no credit card needed.
Next steps: harden your VPS further with our VPS security guide, set up automated backups for your OpenClaw data directory, and if you’re running other services on the same server, our Nginx subdomain + SSL guide covers proxying multiple apps on one VPS.

