UbuntuUbuntu Based

How To Install OpenClaw on Ubuntu 24.04 LTS

Install OpenClaw on Ubuntu 24.04 LTS

Self-hosted AI tools are changing the way developers and sysadmins work, and OpenClaw sits at the top of that wave. If you want to install OpenClaw on Ubuntu 24.04 and get a fully autonomous AI assistant running on your own infrastructure, you are in the right place. This guide walks you through every step — from system preparation to channel integration — in plain, actionable language. By the end, you will have a running OpenClaw instance accessible via a web dashboard, connected to a messaging platform, and secured for production use.

What Is OpenClaw and Why Does It Matter?

OpenClaw (formerly Clawdbot/Moltbot) is a free, open-source, self-hosted AI assistant that you run on your own server or VPS. It connects to messaging platforms like WhatsApp, Telegram, Slack, and Discord, and routes your conversations through AI providers such as OpenAI, Anthropic, and Google Gemini via API keys.

Think of it as a persistent, always-on AI agent that lives on your infrastructure — not in someone else’s cloud. Unlike ChatGPT or Claude, you control the memory, the integrations, and the data.

What OpenClaw Can Do

OpenClaw goes well beyond simple chatting. Here is what it handles out of the box:

  • Everyday automation: Setting reminders, browsing the web, fetching articles, taking notes, organizing files
  • Technical workflows: Running shell commands, creating GitHub issues, automating cron jobs
  • Multi-channel messaging: WhatsApp, Telegram, Slack, Discord — interact from any app
  • Skill extensions: 50+ installable capabilities via ClawHub (clawhub.com)
  • Persistent memory: Remembers past conversations just like ChatGPT, without requiring browser tab switching
  • Gateway architecture: A background systemd daemon that handles routing, session management, and agent monitoring

Why Ubuntu 24.04 LTS?

Ubuntu 24.04 LTS (Noble Numbat) is the most stable, widely-deployed long-term support release as of 2026. It ships with a package ecosystem fully compatible with Node.js 22, which OpenClaw requires. It also receives security patches through 2029, making it an ideal base for any self-hosted tool you plan to run long-term.

A Critical Security Note Before You Begin

OpenClaw is still in Beta. The official documentation and the installation wizard both warn that running it on a machine containing personal files, emails, or sensitive credentials carries real risk. An undiscovered zero-day vulnerability could expose your data.

Best practice: Deploy OpenClaw on a dedicated VPS or an isolated virtual machine — not on your personal laptop or a shared production server. This is not a recommendation; treat it as a hard requirement if you value your data security.

Prerequisites: What You Need Before You Start

Before jumping into the OpenClaw on Ubuntu 24.04 setup, confirm you have the following in place.

System requirements:

Component Minimum Recommended
CPU 1 vCPU 8 vCPU Cores
RAM 4 GB 16 GB
Disk Space 25 GB 50 GB
OS Ubuntu 24.04 LTS Ubuntu 24.04 LTS

Software and access requirements:

  • A running Ubuntu 24.04 LTS instance (VPS or dedicated server)
  • Root or sudo user access
  • SSH access to the server (for VPS deployments)
  • curl and git installed (pre-installed on most Ubuntu images)
  • A valid API key from at least one of: OpenAI, Anthropic, or Google Gemini AI Studio
  • An active internet connection on the server

Confirm your Ubuntu version:

lsb_release -a

Expected output:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.2 LTS
Release:        24.04
Codename:       noble

Step 1: Update Your Ubuntu 24.04 System

Always start with a clean, fully updated system. Outdated packages cause dependency conflicts that will silently break your OpenClaw installation.

sudo apt update && sudo apt upgrade -y

The apt update command refreshes your package index. The apt upgrade -y installs all available upgrades without prompting. The -y flag auto-confirms — skip it if you want to review changes first.

Next, install curl and git if they are missing:

sudo apt install curl git -y

You will need curl to download the installer script and git for any future source-based operations. After the upgrade completes, consider rebooting your server to apply any kernel updates:

sudo reboot

Reconnect via SSH after 30–60 seconds.

Step 2: Log In to Your Server via SSH

This step applies to VPS users. If you are working on a local Ubuntu machine, skip to Step 3.

Connect to your server as the root user:

ssh root@your-server-ip

After logging in, confirm your user identity:

whoami

Expected output:

root

Optional: Create a Dedicated Non-Root User

For tighter security on your Linux server tutorial setup, create a dedicated user for OpenClaw instead of using root:

adduser openclaw-user
usermod -aG sudo openclaw-user
su - openclaw-user

This limits the blast radius if OpenClaw’s process is ever compromised. It is a small step that makes a significant difference in a production environment.

Step 3: Run the OpenClaw Installer Script

This is the core step. OpenClaw provides an official one-line installer that automates the entire installation process — from detecting your OS to launching the interactive onboarding wizard.

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

Breaking down what those flags mean:

  • -f — Fail silently on HTTP errors (no garbage HTML output if the download fails)
  • -s — Silent mode (suppresses download progress noise)
  • -S — Show errors even in silent mode
  • -L — Follow HTTP redirects automatically

What the Installer Does Automatically

You do not need to manually install Node.js or configure npm. The script handles all of this:

  1. Detects your operating system (Ubuntu/Debian)
  2. Updates the local package index
  3. Installs Node.js 22.x from the NodeSource repository
  4. Installs prerequisite packages: git, curl, gnupg, ca-certificates
  5. Installs the OpenClaw CLI globally via npm
  6. Launches the interactive onboarding wizard automatically

Alternative Installation Methods

If you prefer manual control, OpenClaw supports these alternatives:

# Via npm (requires Node 22+ pre-installed)
npm install -g openclaw@latest
openclaw onboard --install-daemon
# Skip onboarding, install binary only
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
# Build from source (for contributors or developers)
git clone https://github.com/openclaw/openclaw.git
cd openclaw
pnpm install && pnpm ui:build && pnpm build
pnpm link --global
openclaw onboard --install-daemon

For most users on Ubuntu 24.04, the one-line installer is the right choice. Stick with it unless you have a specific reason to deviate.

Step 4: Complete the OpenClaw Onboarding Wizard — Configure OpenClaw on Ubuntu 24.04

Once the installer finishes, the onboarding wizard launches automatically as a text-based UI (TUI). This is where you configure OpenClaw on Ubuntu 24.04. Read each screen carefully before pressing Enter — the wizard is sequential and some choices are harder to change later.

4.1 Accept the Security Disclaimer

The first screen presents a security warning about running OpenClaw on machines with personal data. Select Yes and press Enter to confirm you understand the risks and are running on an isolated environment.

4.2 Choose Onboarding Mode

You will see two options:

  • QuickStart — Auto-configures sensible defaults; ideal for beginners
  • Manual — Full control over every setting; recommended for sysadmins

Select Manual if you want to precisely configure the gateway, AI provider, and security settings. Select QuickStart if you want to get running in 60 seconds.

4.3 Configure the Gateway

The gateway is OpenClaw’s core routing engine. It handles inbound traffic from messaging channels, manages agent sessions, and serves the web UI. Configure it as follows:

  • Gateway type: Select Local Gateway bound to the loopback address 127.0.0.1
  • Workspace directory: Press Enter to accept the default (auto-created in your home directory)
  • Gateway port: Press Enter to accept the default — port 18789
  • Gateway bind: Select Loopback (127.0.0.1) — this keeps the gateway off the public internet
  • Gateway auth token: Press Enter to auto-generate a secure token — you will use this to access the dashboard

4.4 Select Your AI Provider and API Key

Next, choose your preferred AI provider:

  • OpenAI (GPT-4o, GPT-4, etc.)
  • Anthropic (Claude 3.5, Claude 3 Opus, etc.)
  • Google Gemini (Gemini 1.5 Pro, Gemini Flash, etc.)

Paste your API key when prompted. OpenClaw stores it locally in ~/.openclaw.json. After entering the key, select the default model — you can change this later in the configuration files.

4.5 Configure Channels, Skills, and Hooks (Optional Now)

The wizard offers you the option to configure messaging channels, install skills, and enable hooks right away. You can safely skip all three for now and configure them post-installation.

A skill is an installed capability (e.g., scraping a website, sending messages, fetching API data). A hook is an event trigger that fires before or after a task. Both are fully configurable after setup.

4.6 Install the Gateway as a System Service

When prompted, confirm the installation of the gateway daemon. This installs OpenClaw’s gateway as a systemd service, so it starts automatically on boot and runs 24/7 in the background. At the final screen, select Open the Web UI — the wizard displays a tokenized dashboard URL. Copy and save it now.

Step 5: Verify the Gateway Is Running

After completing the wizard, confirm the gateway started successfully:

openclaw gateway status

Expected output:

🦞 OpenClaw Gateway — running
  Status:   enabled
  PID:      12345
  Port:     18789
  Bind:     127.0.0.1
  Dashboard: http://127.0.0.1:18789/?token=YOUR_TOKEN

Verify the network listener is active:

ss -pnltu | grep openclaw

Confirm the installed version:

openclaw --version

Run the built-in health check:

openclaw doctor

This command scans your configuration for common issues and reports any warnings or errors. If the gateway is not running, restart it:

openclaw gateway restart

Step 6: Access the OpenClaw Web UI

The gateway binds to 127.0.0.1, which means it is not reachable directly from your browser when OpenClaw runs on a remote VPS. You need to create an SSH tunnel first.

6.1 Create an SSH Tunnel

From your local machine, run:

ssh -N -L 18789:127.0.0.1:18789 root@your-server-ip

What this command does:

  • -N — No remote command execution; only sets up the tunnel
  • -L 18789:127.0.0.1:18789 — Forwards your local port 18789 to port 18789 on the remote server’s loopback interface

After entering your password, you will see a blinking cursor — this confirms the tunnel is active. Leave this terminal session open.

6.2 Open the Dashboard in Your Browser

Navigate to the tokenized URL provided during onboarding:

http://127.0.0.1:18789/?token=YOUR_GENERATED_TOKEN

Or simply open:

http://localhost:18789/

Click Overview in the web UI. A green Connected status badge confirms your gateway is healthy and running correctly.

Step 7: Connect a Messaging Channel

OpenClaw is designed to be interacted with through messaging platforms. While the web UI is useful for monitoring, the real power of this How To Install OpenClaw on Ubuntu 24.04 setup comes from chatting with your AI agent via WhatsApp or Telegram.

7.1 Add WhatsApp

openclaw channels add

Follow the prompts:

  1. Select WhatsApp (QR Link)
  2. Select default (primary account)
  3. Select Link with QR code
  4. Scan the QR code using your phone’s WhatsApp Linked Devices menu
  5. Enter your full phone number with country code (e.g., +628123456789)
  6. Select Finished

7.2 Add Telegram

For Telegram, you first need to create a bot:

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts to create your bot
  3. Copy the bot token BotFather provides
  4. Run openclaw channels add, select Telegram, and paste the token

7.3 Verify Connected Channels

openclaw channels list

Expected output:

🦞 OpenClaw 2026.x.x — curl for conversations.

Chat channels:
- WhatsApp default (Your Name): linked, enabled

Auth providers (OAuth + API keys):
- google:default (api_key)

Test the integration with a direct message from the CLI:

openclaw message send --channel whatsapp --target "+628123456789" --message "Hello from OpenClaw"

Open WhatsApp on your phone — the message should appear immediately.

Understanding OpenClaw’s Configuration Files

Once installed, all OpenClaw data lives inside ~/.openclaw/. Understanding this directory is essential for maintenance, backups, and debugging.

ls -al ~/.openclaw

Key files and directories:

  • ~/.openclaw.json — The master configuration file. Contains your AI provider settings, active channels, gateway config, skills, and session data. Back this up before every update.
  • workspace/ — OpenClaw’s action log directory. Contains AGENTS.md, HEARTBEAT.md, IDENTITY.md, SOUL.md, TOOLS.md, and USER.md — these define the agent’s personality, behavior, and automation reminders.
  • devices/ — Stores paired device info, session tokens, and device approval records
  • agents/ — Individual AI agent definitions, custom skills, and behavior configurations
  • credentials/ — OAuth tokens, API keys, and linked service sessions
  • cron/ — Scheduled task storage for automated jobs

To use custom paths, set these environment variables before launching OpenClaw:

export OPENCLAW_HOME=/path/to/custom/home
export OPENCLAW_STATE_DIR=/path/to/state
export OPENCLAW_CONFIG_PATH=/path/to/config.json

Troubleshooting Common Issues

Even on a clean Ubuntu 24.04 setup, you may hit a few snags. Here are the most common problems and their fixes.

Error 1: openclaw: command not found

Cause: npm’s global binary directory is not in your $PATH.

Fix:

npm prefix -g
echo 'export PATH="$(npm prefix -g)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Then confirm:

openclaw --version

Error 2: Node.js Version Mismatch

Cause: OpenClaw requires Node.js 22+. Your system may have an older version.

Fix: Reinstall Node.js from NodeSource:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
node -v

Error 3: Gateway Fails to Start

Cause: Port conflict, corrupted config, or failed systemd registration.

Fix:

# Check for port conflicts
ss -tlnp | grep 18789

# View gateway logs
journalctl -u openclaw-gateway -n 50

# Restart the gateway
openclaw gateway restart

Error 4: Web UI Not Loading After SSH Tunnel

Cause: The SSH tunnel session closed, or a firewall rule is blocking internal traffic.

Fix:

  1. Check that your SSH tunnel terminal is still open and shows an active blinking cursor
  2. Recreate the tunnel: ssh -N -L 18789:127.0.0.1:18789 root@your-server-ip
  3. Confirm UFW is not blocking the loopback interface: sudo ufw status
  4. Try accessing via http://localhost:18789/ instead of the tokenized URL

Error 5: API Key Rejected

Cause: Incorrect key, expired key, or wrong model tier for your subscription.

Fix:

  1. Verify the key in your AI provider’s dashboard (OpenAI / Google AI Studio / Anthropic Console)
  2. Confirm you have not copied trailing spaces or newlines
  3. Update the key in ~/.openclaw.json under the auth section, then restart the gateway:
openclaw gateway restart

Security Best Practices for Running OpenClaw on Ubuntu

Since OpenClaw runs as a persistent background agent with access to your server’s filesystem and network, tighten your security posture from day one.

  • Never expose port 18789 to the public internet. The gateway binds to 127.0.0.1 by default — do not override this without a firewall rule and authentication layer in place.
  • Protect your gateway auth token. Anyone with this token has full control over your OpenClaw instance.
  • Run OpenClaw as a non-root user. Create a dedicated system user with only the permissions OpenClaw needs.
  • Use a VPS or VM, not your personal machine. This is the single most important isolation step.
  • Keep OpenClaw updated regularly:
npm update -g openclaw
  • Back up your config before updates:
cp ~/.openclaw.json ~/.openclaw.json.backup
  • Take VM snapshots before major configuration changes or version upgrades — rollbacks are much easier with a clean snapshot.

Congratulations! You have successfully installed OpenClaw. Thanks for using this tutorial for installing the OpenClaw Personal AI Assistant on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official OpenClaw website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button