OpenClaw Setup
Install and configure OpenClaw on a fresh Ubuntu server.
OpenClaw is the agent runtime that manages your AI assistant. It handles API calls to Anthropic, tool execution, session history, and the dashboard UI.
Requirements
- Ubuntu 22.04 or 24.04 (tested on both)
- 2+ vCPU, 4GB+ RAM recommended
- Node.js v22+ (OpenClaw requires it)
- A domain pointed at your server
Install
curl -fsSL https://openclaw.ai/install.sh | bash
This installs OpenClaw to /opt/openclaw and creates a openclaw system user.
Environment File
Create /opt/openclaw.env with your API key and version:
ANTHROPIC_API_KEY=sk-ant-...
OPENCLAW_VERSION=2026.2.17
Systemd Service
OpenClaw runs as a systemd service. The installer creates this automatically, but if you need to recreate it:
[Unit]
Description=OpenClaw Agent Runtime
After=network.target
[Service]
Type=simple
User=openclaw
EnvironmentFile=/opt/openclaw.env
ExecStart=/opt/openclaw/openclaw
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
systemctl enable openclaw
systemctl start openclaw
Configuration
The main config is at /home/openclaw/.openclaw/openclaw.json. A minimal working config:
{
"agents": {
"defaults": {
"model": { "primary": "anthropic/claude-sonnet-4-6" },
"sandbox": { "mode": "off", "workspaceAccess": "rw" }
},
"list": [
{
"id": "main",
"name": "Your Agent",
"workspace": "/home/openclaw/.openclaw/workspaces/main",
"model": { "primary": "anthropic/claude-sonnet-4-6" }
}
]
},
"gateway": {
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token",
"token": "your-random-token-here"
},
"trustedProxies": ["127.0.0.1", "::1"]
}
}
Generate a gateway token: openssl rand -hex 32
Caddy Configuration
Caddy proxies requests to OpenClaw's gateway and serves the dashboard:
reef.yourdomain.com {
reverse_proxy localhost:18789
}
yourdomain.com {
root * /home/openclaw/yoursite/public
file_server
handle /api/chat {
reverse_proxy localhost:18789
}
}
Important: OpenClaw's trustedProxies must include both 127.0.0.1 and ::1 — Caddy may connect via IPv6 loopback.
Workspace Setup
Create the workspace directory for each agent and add a SOUL.md:
mkdir -p /home/openclaw/.openclaw/workspaces/main
chown -R openclaw:openclaw /home/openclaw/.openclaw/workspaces/
See Writing a SOUL.md for what to put in it.
Verify
systemctl status openclaw
curl -s http://localhost:18789/health
Then open reef.yourdomain.com in a browser — you should see the OpenClaw dashboard.