logo
How to Setup OpenClaw AI Assistant on a Linux Server - Complete Guide

Jayesh Jain

Feb 4, 2026

6 min read

Share this article

How to Setup OpenClaw AI Assistant on a Linux Server

OpenClaw is a powerful open-source AI assistant framework that lets you run your own AI-powered assistant on any Linux server. Unlike cloud-only solutions, OpenClaw gives you full control over your data while connecting to leading AI models like Claude, GPT-4, and more.

In this guide, we'll walk through setting up OpenClaw on a Linux server from scratch.


What is OpenClaw?

OpenClaw is an open-source AI assistant platform that:

  • Runs on your infrastructure — VPS, home server, or cloud VM
  • Connects to multiple AI providers — Anthropic Claude, OpenAI, Google, and more
  • Integrates with messaging platforms — WhatsApp, Telegram, Discord, Slack, and iMessage
  • Provides a web dashboard — Control and chat via browser
  • Supports automation — Cron jobs, webhooks, and tool integrations
  • Offers sandboxed execution — Safe code execution via Docker

Prerequisites

Before you begin, ensure you have:

  • A Linux server (Ubuntu 22.04+, Debian 12+, or similar)
  • Node.js 22+ installed
  • Root or sudo access
  • An API key from an AI provider (Anthropic, OpenAI, etc.)

Check Node.js Version

1node -v 2# Should output v22.x.x or higher

If you need to install Node.js 22:

1# Using NodeSource 2curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - 3sudo apt-get install -y nodejs

Installation Methods

OpenClaw offers multiple installation paths. Choose the one that fits your needs.

The fastest way to get started:

1curl -fsSL https://openclaw.ai/install.sh | bash

This script:

  1. Installs the openclaw CLI globally via npm
  2. Runs the interactive onboarding wizard
  3. Sets up the Gateway daemon

Method 2: Manual npm Install

If you prefer manual control:

1# Install globally 2npm install -g openclaw@latest 3 4# Run onboarding 5openclaw onboard --install-daemon

Method 3: Docker (Containerized)

For isolated deployments:

1# Clone the repository 2git clone https://github.com/openclaw/openclaw.git 3cd openclaw 4 5# Run Docker setup 6./docker-setup.sh

The Docker setup:

  • Builds the gateway image
  • Runs onboarding
  • Starts the gateway via Docker Compose
  • Generates a secure gateway token

Step-by-Step Setup Guide

Step 1: Run the Installer

1curl -fsSL https://openclaw.ai/install.sh | bash

You'll see output like:

1Installing OpenClaw... 2✓ Node.js version check passed (v22.x.x) 3✓ Installing openclaw globally... 4✓ OpenClaw installed successfully! 5 6Starting onboarding wizard...

Step 2: Configure AI Provider

The onboarding wizard will ask for your AI provider. Choose one:

  • Anthropic Claude (recommended) — Best for coding and reasoning
  • OpenAI — GPT-4o and GPT-4
  • Google AI — Gemini models
  • OpenRouter — Access multiple providers

Enter your API key when prompted:

1? Select your AI provider: Anthropic 2? Enter your Anthropic API key: sk-ant-xxxxx

Step 3: Set Up Messaging Channels (Optional)

OpenClaw can connect to messaging platforms:

WhatsApp:

1openclaw channels login 2# Scan the QR code with your WhatsApp app

Telegram:

1openclaw channels add --channel telegram --token "YOUR_BOT_TOKEN"

Discord:

1openclaw channels add --channel discord --token "YOUR_BOT_TOKEN"

Step 4: Start the Gateway

1# Start the daemon 2openclaw gateway start 3 4# Check status 5openclaw status

Step 5: Access the Dashboard

1# Open the dashboard (generates a tokenized URL) 2openclaw dashboard

This opens the web-based Control UI where you can:

  • Chat with your AI assistant
  • Configure settings
  • Monitor sessions
  • View logs

Configuration

OpenClaw uses a JSON5 config file at ~/.openclaw/openclaw.json.

Basic Configuration Example

1{ 2 // AI provider settings 3 agents: { 4 defaults: { 5 workspace: "~/.openclaw/workspace", 6 model: "anthropic/claude-sonnet-4-20250514" 7 } 8 }, 9 10 // Gateway settings 11 gateway: { 12 port: 18789, 13 bind: "localhost", 14 auth: { 15 token: "your-secure-token" 16 } 17 }, 18 19 // WhatsApp settings 20 channels: { 21 whatsapp: { 22 allowFrom: ["+1234567890"] // Your phone number 23 } 24 } 25}

Expose to Network (with Authentication)

To access from other devices:

1{ 2 gateway: { 3 bind: "lan", // or "0.0.0.0" 4 auth: { 5 token: "your-secure-random-token" 6 } 7 } 8}

⚠️ Always use authentication when exposing to a network!


Docker Setup (Alternative)

For production deployments, Docker provides better isolation.

Quick Docker Setup

1git clone https://github.com/openclaw/openclaw.git 2cd openclaw 3./docker-setup.sh

Mount Your Code Directory

To give OpenClaw access to your projects:

1export OPENCLAW_EXTRA_MOUNTS="/path/to/your/code:/home/node/code:rw" 2./docker-setup.sh

Docker Compose Commands

1# Start 2docker compose up -d openclaw-gateway 3 4# Stop 5docker compose down 6 7# View logs 8docker compose logs -f openclaw-gateway 9 10# Restart 11docker compose restart openclaw-gateway

Useful Commands

1# Check installation health 2openclaw doctor 3 4# View gateway status 5openclaw status 6 7# Check gateway health 8openclaw health 9 10# View logs 11openclaw logs 12 13# Restart gateway 14openclaw gateway restart 15 16# Update OpenClaw 17openclaw update

Connecting from Mobile

WhatsApp

  1. Run openclaw channels login
  2. Scan the QR code with WhatsApp
  3. Send a message to yourself — OpenClaw responds!

Telegram

  1. Create a bot via @BotFather
  2. Add the token: openclaw channels add --channel telegram --token "TOKEN"
  3. Start chatting with your bot

Security Best Practices

  1. Always use authentication — Set gateway.auth.token
  2. Use HTTPS — Put behind a reverse proxy (nginx/Caddy)
  3. Limit access — Use allowFrom in channel configs
  4. Regular updates — Run openclaw update regularly
  5. Backup config — Keep ~/.openclaw/ backed up

Troubleshooting

"openclaw: command not found"

Add npm's global bin to your PATH:

1export PATH="$(npm prefix -g)/bin:$PATH" 2# Add to ~/.bashrc or ~/.zshrc for persistence

Permission Errors

1mkdir -p "$HOME/.npm-global" 2npm config set prefix "$HOME/.npm-global" 3export PATH="$HOME/.npm-global/bin:$PATH"

Gateway Won't Start

1# Check for issues 2openclaw doctor 3 4# View detailed logs 5openclaw logs --level debug

Conclusion

OpenClaw provides a powerful, self-hosted alternative to cloud-only AI assistants. With full control over your data and the flexibility to connect multiple AI providers and messaging platforms, it's ideal for developers and businesses who want AI assistance without vendor lock-in.

Key benefits:

  • ✅ Self-hosted and open source
  • ✅ Connect to Claude, GPT-4, Gemini, and more
  • ✅ WhatsApp, Telegram, Discord, Slack integration
  • ✅ Web dashboard for easy management
  • ✅ Docker support for production deployments

Ready to get started? Run the installer:

1curl -fsSL https://openclaw.ai/install.sh | bash

Resources

Share this article

Inspired by This Blog?

Join our newsletter

Get product updates and engineering insights.

JJ

Jayesh Jain

Jayesh Jain is the CEO of Tirnav Solutions and a dedicated business leader defined by his love for three pillars: Technology, Sales, and Marketing. He specializes in converting complex IT problems into streamlined solutions while passionately ensuring that these innovations are effectively sold and marketed to create maximum business impact.

Need help setting up AI assistants for your business?

Contact our team for custom AI assistant implementation and integration services.

Let’s Talk