- Use Ubuntu 22.04 LTS — most tested, supported until 2027, and perfectly compatible with OpenClaw
- Never use Ubuntu's default apt Node.js — it ships version 12, which is incompatible with OpenClaw
- Install Node.js 20 LTS via NodeSource for a guaranteed-compatible, up-to-date runtime
- OpenClaw runs headless on Ubuntu Server — no GUI required at any point
- Wrap in a systemd service for auto-restart on crash and auto-start on reboot
Ubuntu is where most OpenClaw servers live. The combination of LTS stability, wide community documentation, and first-class Node.js support makes it the default choice for builders deploying agents at any scale. Here's the exact installation sequence — no guessing required.
Choosing Your Ubuntu Version
Ubuntu 22.04 LTS (Jammy Jellyfish) is the recommended version for OpenClaw as of early 2025. It receives security updates until April 2027, has the most community-tested configurations, and runs on virtually all cloud providers. Ubuntu 24.04 LTS (Noble Numbat) also works and is a solid choice for new servers provisioned today.
Avoid Ubuntu 20.04 for new deployments — it's approaching end of standard support. Avoid non-LTS releases (23.04, 23.10) for production use — they only receive 9 months of updates.
Install Node.js 20 LTS via NodeSource
# Update system packages
sudo apt-get update && sudo apt-get upgrade -y
# Install prerequisites
sudo apt-get install -y curl gnupg
# Add NodeSource repository for Node.js 20 LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Install Node.js (includes npm)
sudo apt-get install -y nodejs
# Confirm versions
node --version # v20.x.x
npm --version # 10.x.x
sudo apt install nodejs without the NodeSource setup script installs this ancient version. OpenClaw requires Node.js 18+. Always use the NodeSource setup script first — it configures the correct repository before the install.Install OpenClaw CLI
# Install OpenClaw globally
npm install -g @openclaw/cli
# Verify installation
openclaw --version
# View available commands
openclaw --help
The global install places the openclaw binary in /usr/bin/openclaw (when installed as root via NodeSource) or ~/.npm/bin/openclaw (when installed as a regular user). Both paths are automatically in PATH on Ubuntu after a NodeSource install.
Configure and Run Your First Agent
Before starting the gateway, create a config directory and a minimal gateway config:
# Create config directory
mkdir -p ~/.openclaw
# Initialize a default config
openclaw init
# Edit the config to add your LLM API key
nano ~/.openclaw/gateway.yaml
At minimum, add your LLM provider API key to gateway.yaml. For OpenAI:
llm:
provider: openai
api_key: sk-your-key-here
model: gpt-4o
server:
host: 0.0.0.0
port: 8080
Test the gateway directly first:
openclaw serve
# In another terminal, check it's responding
curl http://localhost:8080/health
Create a Systemd Service
sudo nano /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw AI Agent Gateway
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/usr/bin/openclaw serve
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw
OpenClaw now starts automatically on every reboot and restarts within 5 seconds of any crash. View logs with journalctl -u openclaw -f.
Common Mistakes
Using the wrong apt Node.js. I've seen this break more Ubuntu installs than any other issue. The fix takes 30 seconds: remove the wrong version with sudo apt-get remove nodejs, run the NodeSource setup script, then install again. Don't try to patch an incompatible Node version — just start clean.
Running the gateway as root. Ubuntu's default user is typically named "ubuntu" on cloud instances. Use that user in your systemd unit file. If you're on a local machine, use your own username. The root user should never run persistent network services.
Forgetting to open the firewall. Ubuntu Server doesn't come with UFW enabled by default on all cloud providers, but some providers (DigitalOcean, for instance) have their own firewall rules at the network level. Check both ufw status and your provider's control panel firewall settings if your gateway is unreachable from outside.
Frequently Asked Questions
What Ubuntu version should I use for OpenClaw?
Ubuntu 22.04 LTS is recommended. It has long-term support until 2027, the most tested community configurations, and is compatible with all current OpenClaw features. Ubuntu 24.04 LTS also works for new deployments.
Why shouldn't I use Ubuntu's default Node.js package?
Ubuntu 22.04's default apt Node.js is version 12.x — far below OpenClaw's minimum requirement of Node.js 18. Always use NodeSource or nvm to install Node.js 18 or 20 LTS.
How do I check if OpenClaw is running on Ubuntu?
With systemd: run systemctl status openclaw. Without systemd: ps aux | grep openclaw or curl http://localhost:8080/health. View full logs with journalctl -u openclaw -f.
Does OpenClaw work on Ubuntu Server (headless)?
Yes. OpenClaw is a Node.js CLI application that runs entirely headless — no GUI required. Ubuntu Server is the ideal deployment environment. No desktop interface is needed at any point.
How much RAM does OpenClaw need on Ubuntu?
OpenClaw uses 80–150MB of RAM itself. Gateway and skills together use 200–400MB under moderate load. 512MB is workable, 1GB is comfortable, 2GB gives headroom for memory-intensive skills like RAG or browser automation.
Can I install OpenClaw on Ubuntu in Docker?
Yes. The official Docker image works on Ubuntu hosts. Run docker pull openclaw/openclaw and mount a volume for your config. See the Docker deployment guide for the full compose stack with persistent storage.
Your Ubuntu OpenClaw server is live. NodeSource gave you a current Node.js runtime, npm installed the CLI in seconds, and systemd ensures it never stays down after a crash or reboot. From here, configure your channels — Telegram, WhatsApp, Discord — and your agent is fully operational.