- OpenClaw runs on any Linux distro with Node.js 18+ — Ubuntu, Debian, Fedora, Arch, all work identically
- Create a dedicated system user for OpenClaw — never run it as root
- Use a systemd unit file for process management — it handles restarts, logging, and boot startup automatically
- Open only port 8080 (or your configured port) — put Nginx in front to handle TLS and expose only 443
- Update with npm update -g @openclaw/cli then systemctl restart openclaw
Fifteen minutes from a fresh Ubuntu server to a running OpenClaw agent — that's the benchmark. Linux makes this achievable because there's no PATH confusion, no antivirus interference, and systemd handles everything after the initial install. Here's the exact sequence that works every time.
Prerequisites
You need a Linux server with:
- Any modern distro — Ubuntu 22.04 LTS is recommended for this guide
- At least 512MB RAM (1GB recommended for LLM API calls under load)
- Outbound internet access for npm install and LLM API calls
- SSH access and sudo privileges
This works on bare metal, VPS (Hetzner, DigitalOcean, Vultr), or local machines. The commands are identical.
Install Node.js
Never use Ubuntu's default apt Node.js — it's outdated. Use NodeSource:
# Update package list and install curl
sudo apt-get update && sudo apt-get install -y curl
# Add NodeSource repository for Node.js 20 LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# Install Node.js
sudo apt-get install -y nodejs
# Verify
node --version # v20.x.x
npm --version # 10.x.x
For Fedora/RHEL-based systems, replace the curl command with the NodeSource RPM setup script. For Arch Linux, use sudo pacman -S nodejs npm — Arch's repos stay current.
Create a Dedicated User and Install OpenClaw
Running OpenClaw as root is a security risk. Create a dedicated system user:
# Create system user with no login shell
sudo useradd -r -s /bin/false -m -d /var/lib/openclaw openclaw
# Switch to that user's context and install OpenClaw
sudo -u openclaw npm install -g --prefix /var/lib/openclaw/.npm @openclaw/cli
# Add the install prefix bin to the service PATH (used in systemd unit below)
# Binary is at: /var/lib/openclaw/.npm/bin/openclaw
npm install -g @openclaw/cli. The dedicated user approach is for multi-user or security-sensitive environments where process isolation matters.Create a Systemd Service
Systemd handles startup on boot, automatic restarts on crash, and centralized logging via journald. Create the unit file:
sudo nano /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw AI Agent Gateway
After=network.target
[Service]
Type=simple
User=openclaw
WorkingDirectory=/var/lib/openclaw
ExecStart=/usr/bin/openclaw serve
Restart=always
RestartSec=10
Environment=NODE_ENV=production
Environment=OPENCLAW_CONFIG=/var/lib/openclaw/config/gateway.yaml
[Install]
WantedBy=multi-user.target
# Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
# Check status
sudo systemctl status openclaw
# View logs
sudo journalctl -u openclaw -f
OPENCLAW_CONFIG environment variable in the unit file must point to a real gateway.yaml. Create this file before starting the service or OpenClaw will error on launch. Copy the example config from the OpenClaw docs and customize your LLM provider and channels.Firewall and Security
Open the gateway port with UFW (Ubuntu) or firewalld (Fedora):
# Ubuntu/Debian with UFW
sudo ufw allow 8080/tcp
sudo ufw enable
# Fedora/RHEL with firewalld
sudo firewall-cmd --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
For production, put Nginx in front as a reverse proxy. This lets you terminate TLS at Nginx and keep the OpenClaw gateway bound to localhost only:
# In gateway.yaml — bind to localhost only
server:
host: 127.0.0.1
port: 8080
# In Nginx config
server {
listen 443 ssl;
server_name agent.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
This configuration exposes only port 443 (HTTPS) to the internet. Port 8080 is never reachable from outside the server.
Common Mistakes
Running OpenClaw as root. Every process running as root that touches the internet is a security liability. The mistake costs nothing extra to avoid — just create the system user. If something goes wrong with a root process, an attacker has full system access. Under the dedicated openclaw user, the blast radius is contained to that user's files.
Not setting Restart=always in the systemd unit. Without it, if OpenClaw crashes (network blip, OOM, bad skill), it stays down until you manually restart it. The restart directive makes it self-healing at no extra cost.
Exposing the gateway directly on port 8080 to the internet without TLS. Any webhook or channel integration you configure will send data over plaintext HTTP. Put Nginx in front, get a Let's Encrypt certificate, and enforce HTTPS from day one.
Frequently Asked Questions
What Linux distributions support OpenClaw?
OpenClaw runs on any Linux distribution supporting Node.js 18+. This includes Ubuntu 20.04+, Debian 11+, Fedora 36+, Arch Linux, CentOS Stream 9+, and Rocky Linux 9+. The installation process is identical across distributions.
Should I use a dedicated user account for OpenClaw on Linux?
Yes. Create a dedicated system user like 'openclaw' with no login shell. Run the service under this user in your systemd unit file. This limits the blast radius if the process is ever compromised.
How do I run OpenClaw as a systemd service on Linux?
Create a unit file at /etc/systemd/system/openclaw.service with ExecStart pointing to your openclaw binary and User set to your dedicated service account. Run systemctl enable openclaw to start on boot and systemctl start openclaw to start immediately.
What firewall ports does OpenClaw need on Linux?
The gateway listens on port 8080 by default. Open this inbound with ufw allow 8080/tcp. For production, use Nginx as a reverse proxy and only expose ports 80 and 443 — keep 8080 bound to localhost.
How do I update OpenClaw on Linux?
Run npm update -g @openclaw/cli then systemctl restart openclaw. Check versions before and after with openclaw --version. Always read the changelog before updating in production.
Can I run multiple OpenClaw instances on one Linux server?
Yes. Run each instance on a different port, create a separate systemd service unit for each, and use a reverse proxy to route traffic to the correct instance based on subdomain or path.
Your Linux OpenClaw server is now production-ready: dedicated user, systemd service with auto-restart, firewall configured, and Nginx handling TLS. This setup runs unattended — when the server reboots, OpenClaw comes back up automatically. When it crashes, systemd restarts it within 10 seconds. That's the foundation every serious deployment needs.