Install OpenClaw on Ubuntu 24.04 in 15 Minutes

Set up your own AI assistant with WhatsApp, Telegram, and Discord integration on Ubuntu 24.04. Works with Claude, GPT, or local models.

Problem: Running a Personal AI Assistant 24/7

You want an AI assistant that runs on your own infrastructure, integrates with your messaging apps, and doesn't send your data to third-party clouds.

You'll learn:

  • How to install OpenClaw on Ubuntu 24.04
  • Configure it with any LLM provider (Anthropic, OpenAI, local models)
  • Connect it to WhatsApp, Telegram, or Discord
  • Set up the systemd service for 24/7 operation

Time: 15 min | Level: Intermediate


Why OpenClaw on Ubuntu 24.04

OpenClaw is an open-source AI assistant that runs entirely on your infrastructure. Ubuntu 24.04 LTS provides the best supported environment with systemd integration for automatic startup and background operation.

What makes it different:

  • Runs on your hardware - full data control
  • Works with any LLM - Claude, GPT, Gemini, or local models
  • Chat integration - WhatsApp, Telegram, Discord, Slack, iMessage
  • Persistent memory - remembers context across conversations
  • Extensible skills - build custom capabilities

Common use cases:

  • Email management and calendar automation
  • File organization and search
  • Web browsing and data extraction
  • Code execution and system tasks
  • 24/7 availability from any messaging app

Requirements

System specs:

  • Ubuntu 24.04 LTS (22.04 also works)
  • 2GB RAM minimum (4GB recommended for production)
  • 10GB free disk space
  • sudo/root access

Software:

  • Node.js 22+ (we'll install this)
  • Internet connection for package downloads

Optional:

  • VPS for 24/7 operation (DigitalOcean, Hetzner, AWS)
  • AI provider API key (Anthropic, OpenAI, or Google)

Solution

Step 1: Update System and Install Node.js 22

OpenClaw requires Node.js 22 or newer for modern JavaScript features and performance.

# Update package lists
sudo apt update && sudo apt upgrade -y

# Install required build tools
sudo apt install -y curl build-essential

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

Expected output:

Node.js 22.x repository successfully configured
Reading package lists... Done
Setting up nodejs (22.x.x-1nodesource1) ...

Verify installation:

node --version  # Should show v22.x.x
npm --version   # Should show 10.x.x or higher

If it fails:

  • Error: "curl: command not found": Run sudo apt install curl -y first
  • Node version wrong: The NodeSource script sometimes fails silently - try running the curl command again

Step 2: Install OpenClaw

Use npm to install OpenClaw globally, making it available system-wide.

# Install OpenClaw globally
npm install -g openclaw@latest

# Verify installation
openclaw --version

Expected: Version number like openclaw v2026.1.30

Why global install: This makes the openclaw command available from any directory and allows systemd to find it easily.

If npm install hangs on 1GB RAM VPS:

# Increase Node memory limit for installation
export NODE_OPTIONS="--max-old-space-size=2048"
npm install -g openclaw@latest

Alternative: Create swap if needed:

# Only if install still fails due to memory
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Step 3: Run the Onboarding Wizard

The interactive wizard configures your AI provider, gateway settings, and optional messaging channels.

# Start onboarding with daemon installation
openclaw onboard --install-daemon

What happens:

  1. Choose AI provider - Select Anthropic, OpenAI, Google, or local model
  2. Enter API key - Paste your provider's API key
  3. Select model - Choose from available models (e.g., Claude Sonnet, GPT-4)
  4. Configure gateway - Default port 18789, localhost binding
  5. Optional channels - Skip for now (we'll add later)
  6. Install service - Creates systemd unit for auto-start

For Anthropic (Claude):

For local models:

  • Select "Custom API endpoint"
  • Point to Ollama, LM Studio, or other local server
  • No API key needed

Expected output:

✓ AI provider configured: Anthropic
✓ Model selected: claude-sonnet-4-20250514
✓ Gateway config written to ~/.openclaw/openclaw.json
✓ Systemd service installed
✓ Gateway started successfully

Step 4: Verify Gateway is Running

Check that the OpenClaw gateway service started correctly.

# Check service status
openclaw gateway status

Expected:

● openclaw-gateway.service - OpenClaw Gateway
   Loaded: loaded
   Active: active (running) since [timestamp]
   Main PID: 1234

If not running:

# Start the service manually
openclaw gateway start

# View logs if issues
journalctl -u openclaw-gateway.service -n 50

Start on boot: The --install-daemon flag already enabled this. Verify with:

systemctl is-enabled openclaw-gateway.service
# Should output: enabled

Step 5: Access the Control UI

The Control UI lets you chat with OpenClaw in your browser without setting up messaging apps first.

# Open dashboard (auto-launches browser)
openclaw dashboard

Default URL: http://127.0.0.1:18789

Security note: The URL includes a one-time token for authentication. Each openclaw dashboard command generates a new secure session.

For remote VPS access: Use SSH tunnel to securely access the dashboard:

# On your local machine
ssh -L 18789:127.0.0.1:18789 username@your-vps-ip

# Then open browser to http://127.0.0.1:18789

Try a test message:

Hello! What can you help me with?

If OpenClaw responds, your installation is working.


Step 6: Connect Messaging Apps (Optional)

Add WhatsApp, Telegram, or Discord integration for mobile access.

Telegram (Easiest)

# Start channel setup
openclaw channels add

# Select Telegram
# Follow prompts to create bot via @BotFather
# Get bot token and paste it
# Authorize with your phone number

Get Telegram bot token:

  1. Open Telegram and message @BotFather
  2. Send /newbot
  3. Choose name and username
  4. Copy the token provided

WhatsApp

openclaw channels add
# Select WhatsApp Web
# Scan QR code with your phone

Requires: Phone stays connected to internet. WhatsApp Web uses your phone as relay.

Discord

openclaw channels add
# Select Discord
# Create bot in Discord Developer Portal
# Get bot token and client ID
# Invite bot to your server

Discord bot setup:

  1. Go to https://discord.com/developers/applications
  2. New Application → Bot → Reset Token
  3. Enable "Message Content Intent"
  4. Generate OAuth2 URL with bot permissions

Verification

Test full workflow:

# 1. Check gateway is running
openclaw gateway status

# 2. View real-time logs
openclaw logs --follow

# 3. Send test message via dashboard
openclaw dashboard

Expected behavior:

  • Gateway responds within 1-2 seconds
  • Messages appear in logs
  • Responses are coherent and context-aware

Check configuration:

# View current config
cat ~/.openclaw/openclaw.json | jq .

What You Learned

  • OpenClaw runs as a persistent gateway service on Ubuntu
  • Node.js 22+ is required for modern JavaScript features
  • The onboarding wizard handles most configuration automatically
  • systemd integration provides reliable 24/7 operation
  • Control UI works immediately, messaging apps need channel setup

Limitations:

  • 2GB RAM minimum - lower specs cause OOM errors during heavy use
  • WhatsApp requires phone connection - Telegram doesn't
  • API costs apply to cloud models - local models are free but slower

When to upgrade:

  • More than 10 messages/minute → 4GB RAM
  • Multiple concurrent channels → Consider dedicated VPS
  • Production use → Add reverse proxy (nginx) with HTTPS

Next Steps

Add capabilities:

Production hardening:

  • Set up nginx reverse proxy with SSL
  • Configure firewall rules (UFW)
  • Add monitoring with Prometheus/Grafana
  • Implement backup strategy for ~/.openclaw/

Community resources:


Tested on Ubuntu 24.04 LTS, OpenClaw v2026.1.30, Node.js 22.12.0

Common errors and fixes:

ErrorCauseFix
npm: command not foundNode.js not in PATHRestart Terminal or run source ~/.bashrc
Port 18789 already in usePrevious instance runningopenclaw gateway stop then retry
OOM during installInsufficient RAMAdd swap file or upgrade to 2GB+
Gateway won't startMissing dependenciessudo apt install build-essential -y
Token expired in browserDashboard session timeoutRun openclaw dashboard again