GICT knowledge base
Deploy OpenClaw (Self Hosted AI Agent) on Ubuntu: Step by Step Guide
Published
OpenClaw (previously known as Clawdbot and Moltbot) is an open-source, self-hosted AI agent designed to act as a personal assistant. It runs locally on your machine, integrates with messaging apps like WhatsApp, Telegram, Slack, and others, and can perform autonomous tasks such as managing emails, browsing the web, executing shell commands, and automating workflows. Unlike traditional chatbots, it operates 24/7, maintains context across interactions, and can connect to external tools and APIs. It’s built in TypeScript, MIT-licensed, and stores data locally as Markdown files for privacy.
This tutorial focuses on deploying OpenClaw on Ubuntu (tested on versions like 24.04 and 25), assuming a local setup on a physical machine, VM, or VPS. For cloud deployments (e.g., AWS Lightsail or Oracle Cloud), refer to provider-specific guides, but the core steps remain similar. We’ll cover installation from source, configuration, running the agent, and integrations.
Note: OpenClaw requires an API key from an LLM provider (e.g., Anthropic, OpenAI) for AI capabilities, as it doesn’t include built-in models by default. You can also integrate local models via Ollama for offline use. Always run OpenClaw as a non-root user for security, and consider sandboxing with Docker if granting it access to sensitive tools.
Prerequisites
First of all, You will need an Ubuntu server or VPS. You can deploy one with Interserver.
Make sure your Ubuntu server meets these requirements:
- Operating System: Ubuntu 22.04 or later (64-bit). Tested on 24.04.
- Minimum Hardware Requirements: At least 2 GB RAM (4 GB recommended for stability), 2 CPU cores, and sufficient storage (minimum 10 GB free for dependencies and models if using Ollama).
- API Key: Sign up for an LLM provider like Anthropic (Claude models recommended for agentic tasks), OpenAI, or Grok (xAI). Generate an API key from their developer dashboard.
- User Permissions: Run all commands as a non-root user. If using a VPS, SSH in as a standard user (e.g., ubuntu) or create a user with sudo access.
If you have everything needed, We can get started with the setup on a fresh Ubuntu server. First, Execute the following command to update your system.
$ sudo apt-get update && sudo apt-get upgrade -y
Once done, We need to install NVM to manage node version on our server.
Step 1: Install Node.js (If Not Already Installed)
OpenClaw requires Node.js >=22. We will use nvm (Node Version Manager) for multi-version support.
Execute the following commands one by one to install and activate Node v24 on your server:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ source ~/.bashrc
$ nvm install 24
$ nvm use 24
You can verify the installation by executing node -v and npm -v. If you see the Node version as 24 and npm as 11, We are good to move forward.
Step 2: Install OpenClaw
OpenClaw offers a simple global installation via npm. This pulls the latest version from npm and sets up the CLI.
Install globally:
$ npm install -g openclaw@latest
This may take 1-5 minutes depending on your connection. It installs dependencies like the gateway and core libraries.
Verify installation:
$ openclaw --version # Should output the current version, e.g., 2026.x.x
If you see the openclaw version after executing the above given command, we can move forward with the openclaw setup.
Step 3: Onboarding and Initial Setup
Run the onboarding wizard to configure your workspace, AI model, and daemon.
Start onboarding:
$ openclaw onboard --install-daemon
This command:
- Installs the Gateway as a systemd user service (runs in background on Linux).
- Creates a workspace at ~/.openclaw/ (or custom path).
- Prompts for AI model setup.
During the wizard, It will ask you many questions and will also ask you for the API key of your AI model as well as other tools you might want to have in your agent. Here is how you can deal with the options for now.
- I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue? Yes
- Onboarding mode – Quick Start
- Model/auth provider – Select your favourite. Paste your API key when prompted. Choose a model like “claude-opus-4-6” for best performance.
- Channels – Integrate your Agent with the messaging app that you use on regular basis. You can skip this step if you want to access your model directly from the browser.
- Web Search – Select the web search provider you want to use and provide the API key when prompted.
- Skills – Skills are the different capabilities that your model can have. You can install the skills that you like and move forward with it. Some skills may require API key of the provider. For example, Google places. You can skip and also install them later.
- Hooks – Select the hooks that you want to set up with your agent. You can skip it too.
- Gateway Service Installation – Yes
- How do you want to hatch your bot? Open the Web UI
Finally, After completing the full setup, You will see an output like the following.
◇ Dashboard ready ────────────────────────────────────────────────────────────────╮ │ │ │ Dashboard link (with token): │ │ http://127.0.0.1:18789/#token=0ed99e8a8ce9dcee01bf3c40f38581c388236c8854e7d923 │ │ Copy/paste this URL in a browser on this machine to control OpenClaw. │ │ No GUI detected. Open from your computer: │ │ ssh -N -L 18789:127.0.0.1:18789 root@YOUR_SERVER_IP │ │ Then open: │ │ http://localhost:18789/ │ │ http://localhost:18789/#token=0ed99e8a8ce9dcee01bf3c40f38581c388236c8854e7d923 │ │ Docs: │ │ https://docs.openclaw.ai/gateway/remote │ │ https://docs.openclaw.ai/web/control-ui │ │ │ ├──────────────────────────────────────────────────────────────────────────────────╯
The wizard saves configs to ~/.openclaw/openclaw.json.
Note: ~/.openclaw/openclaw.json is the main configuration file of your openclaw setup. It allows and manages everything from the gateway to model and channel information. Do not modify it manually if you do not have a backup.
Step 4: Starting up Your Main Agent (Web UI)
Due to security reasons, OpenClaw backend is recommended to be accessed from the local machine only. Hence, It is not possible to access it just by using http://IP_ADDRESS:18789/#token=0ed... in the URL.
The best way to access it quickly is using the SSH tunneling. See the highlighted line in the above given example output. You will see similar line in your case too.
Fire up the terminal in your local machine or laptop and execute the following command to create a secure tunnel:
$ ssh -N -L 18789:127.0.0.1:18789 root@YOUR_SERVER_IP
If there are any errors or the gaeway is not running, You will see errors while executing this command.
It will not return any output if everything is fine. In this case, Open the new tab in your browser and run the following URL (Update the token accordingly):
http://127.0.0.1:18789/#token=0ed99e8a8ce9dcee01bf3c40f38581c388236c8854e7d923
Congratulations! Your personal AI agent is ready to take your orders and help you become more productive.
OpenClaw Capabilities: What Your AI Agent Can Actually Do
Once deployed, OpenClaw becomes your proactive, autonomous personal assistant that lives in your messaging apps and acts on your behalf. Unlike traditional LLMs that only respond, OpenClaw executes real-world tasks through a modular tool + skill system.
Core Capabilities
- Messaging & Multi-Channel Integration Interact via WhatsApp, Telegram, Discord, Slack, Signal, iMessage, Google Chat, and more (with community plugins for Mattermost, etc.). Supports DMs, group chats, and threaded conversations. The agent maintains long-term context across apps and sessions.
- Autonomous & Scheduled Execution A configurable heartbeat scheduler wakes the agent periodically (e.g., every 5–30 minutes) to check emails, calendar events, pending tasks, or run cron-like jobs—even when you’re not chatting. This enables true “set it and forget it” automation.
- Tool Access & Actions Built-in tools let the agent:
- Run shell commands (exec)
- Control a headless browser (search, fill forms, scrape)
- Read/write/edit local files
- Send/receive emails (Gmail/Outlook/IMAP)
- Manage calendars (Google Calendar, iCal)
- Handle files (upload/download/parse PDFs, etc.)
- Interact with APIs (custom hooks)
- Modular Skills & Plugins Extend functionality with skills (reusable capability packages) and plugins:
- Knowledge base search
- PDF/OCR parsing
- Smart home control
- Trading/Finance APIs
- n8n/Zapier workflow triggers Install via CLI: openclaw skill add <name> or openclaw plugin add <repo>.
- Multi-Agent & Routing Run isolated agents per workspace, user, or channel. Route messages to different models or behaviors based on sender/context.
- Memory & Context Management Persistent memory stored as Markdown files in your workspace (~/.openclaw by default). Supports long contexts (1M+ tokens on capable models) for deep conversations and task continuity.
- Security & Privacy Runs fully locally/self-hosted. Data never leaves your machine unless you explicitly allow API calls. Device pairing, allowlists, and sandboxing protect against misuse.
Supported Models & Providers
OpenClaw is model-agnostic and excels with strong reasoning models. Configure via openclaw models set or the Control UI.
- Recommended for Best Performance (2026.x):
- Anthropic: claude-opus-4-6, claude-sonnet-4-6 (top choice for agentic tasks due to tool use and reasoning)
- OpenAI: gpt-4.1, o1-preview variants
- Google: gemini-2.5-flash, gemini-2.0-pro
- Local/Offline Options:
- Ollama integration: glm47-flash, llama3.1-70b, qwen2.5-coder (requires sufficient RAM/GPU; great for privacy)
- Other providers: OpenRouter, Groq, Together AI, GitHub Copilot, etc.
Use openclaw models list –all to see available models per provider. Fallbacks are supported: e.g., primary Claude -> fallback Ollama on rate limits/API downtime.
Pro tip: For complex automation, use models with large context windows (1M+) and strong tool-calling (Anthropic leads here).
Key CLI Commands
OpenClaw’s CLI follows a noun-verb pattern (e.g., openclaw <noun> <subcommand>). Here are the most useful ones:
- Status & Diagnostics
- openclaw status: overall health check
- openclaw gateway status: check if the gateway daemon is running
- openclaw doctor: full diagnostic run (configs, migrations, health)
- openclaw logs –follow: tail gateway/agent logs in real-time
- Models & Configuration
- openclaw models status: show default model, fallbacks, auth status
- openclaw models list: list installed/available models
- openclaw models set anthropic/claude-sonnet-4-6: change primary model
- openclaw config get agents.defaults.models: view allowlisted models
- openclaw config set gateway.controlUi.allowedOrigins ‘[“https://your-domain.com”]’: update origins (as we did earlier)
- Channels & Messaging
- openclaw channel add whatsapp: add a new messaging channel (scan QR, etc.)
- openclaw message send –to +1234567890 –message “Test”: send a message
- openclaw agent –message “Summarize my inbox”: test agent directly
- Devices & Security
- openclaw gateway devices list: show connected/pairing devices
- openclaw gateway devices approve <id>: approve a new device for Control UI
- Other Essentials
- openclaw onboard: re-run wizard
- openclaw skill add <skill>: install extensions
- openclaw gateway restart: reload gateway
You can also execute openclaw --help in your terminal to get full list of CLI operations that you can perform.
Conclusion
You’ve now successfully deployed your own powerful, self-hosted OpenClaw instance on Ubuntu, complete with secure remote access via a domain and HTTPS, multi-channel messaging integrations, and full agentic capabilities.
As the project continues to grow rapidly (with an active community on GitHub and Discord), stay updated via the official docs at https://docs.openclaw.ai and experiment safely. Start with low-risk tools, monitor logs, and sandbox sensitive actions.
Related InterServer guide: If you want AI agents to connect directly to InterServer hosting tools, read InterServer MCP Server: Connect AI Agents to Your Hosting Account.
Related guides
How to Secure the Ollama API with Nginx
Protect a private Ollama API with Nginx authentication and restricted routes. Verify allowed requests, denied management calls and direct-port isolation.
AIHow to Set Up an LLM Gateway with LiteLLM
Configure a LiteLLM gateway with private administration, virtual keys and model restrictions. Test allowed requests and understand budget limitations.
AIHow to Self-Host Karakeep with AI Tagging on a VPS
Self-host Karakeep with local Ollama tagging. Restrict first-user setup, disable public registration and verify collection, search and suggested tags.
AIHow to Categorize Support Tickets with a Local AI Model
Suggest support-ticket categories from a CSV using a CPU-only AI model. Keep inference local, preserve ticket IDs, and review uncertain classifications.
