How do I install OpenClaw on Linux?

Clawpedia · For Humans

Complete instructions for setting up OpenClaw on popular Linux distributions like Ubuntu, Debian, and Fedora.

How Do I Install OpenClaw on Linux?

Linux is the natural home for OpenClaw — most servers, containers, and CI/CD pipelines run Linux, making it the most versatile platform for both personal and production deployments. This guide covers installation on Ubuntu/Debian, Fedora/RHEL, Arch, and headless servers.

---

Prerequisites

RequirementMinimumRecommended
OSUbuntu 20.04 / Debian 11 / Fedora 36Ubuntu 22.04+ / Fedora 39+
RAM2 GB8 GB+ (for local models)
Disk Space500 MB2 GB+
Node.jsv18.0v20 LTS

Install Node.js

Shellbashzsh or fish

Ubuntu / Debian:


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

Fedora / RHEL:


sudo dnf install -y nodejs

Arch Linux:


sudo pacman -S nodejs npm

Verify:


node --version   # v18.x+
npm --version    # 9.x+

---

Installation Methods

Method 1: npm (Universal)

Works on any Linux distribution with Node.js installed:


npm install -g openclaw

Method 2: Shell Script (Recommended for Quick Start)

The official one-liner detects your distribution and architecture:


curl -fsSL https://get.openclaw.dev | bash

This script:

Method 3: Package Managers

Ubuntu / Debian (apt):


sudo add-apt-repository ppa:openclaw/stable
sudo apt update
sudo apt install openclaw

Fedora / RHEL (dnf):


sudo dnf copr enable openclaw/stable
sudo dnf install openclaw

Arch Linux (AUR):


yay -S openclaw

Method 4: From Source


git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm install
npm run build
sudo npm link

---

First-Time Configuration


openclaw init

The wizard walks you through:


? Select your AI provider: OpenAI
? Enter your API key: sk-••••••••
? Default model: gpt-4o
? Enable persistent memory: Yes
? Start gateway on login: Yes
✓ Configuration saved to ~/.openclaw/config.yaml

Configuration File Location

On Linux, OpenClaw stores configuration in:

FilePurpose
~/.openclaw/config.yamlMain configuration
~/.openclaw/memory/Persistent memory store
~/.openclaw/skills/Installed skills
~/.openclaw/logs/Log files

---

Running as a systemd Service

For always-on operation (messaging integrations, scheduled tasks), set up a systemd service:

Automatic Setup


openclaw gateway install-service

This creates and enables a user-level systemd service.

Manual Setup

Create ~/.config/systemd/user/openclaw.service:


[Unit]
Description=OpenClaw Gateway
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/openclaw gateway start --foreground
Restart=on-failure
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=default.target

Enable and start:


systemctl --user daemon-reload
systemctl --user enable openclaw
systemctl --user start openclaw

# Enable lingering so the service runs without login
sudo loginctl enable-linger $USER

Managing the Service


systemctl --user status openclaw
systemctl --user restart openclaw
journalctl --user -u openclaw -f   # Follow logs

---

Headless Server Setup

For servers without a GUI:


# Install (minimal dependencies)
curl -fsSL https://get.openclaw.dev | bash

# Non-interactive init
openclaw init --provider openai --api-key sk-your-key --model gpt-4o --no-interactive

# Start gateway
openclaw gateway start --daemon

SSH Access to OpenClaw

Chat with your agent remotely:


ssh myserver 'openclaw chat "Check disk usage and report any issues"'

---

Docker Installation

For containerized deployments:


docker pull openclaw/openclaw:latest

docker run -d \
  --name openclaw \
  -v ~/.openclaw:/root/.openclaw \
  -p 3777:3777 \
  -e OPENAI_API_KEY=sk-your-key \
  openclaw/openclaw:latest gateway start --foreground

Or use Docker Compose — see the dedicated Docker guide for full details.

---

ARM / Raspberry Pi

OpenClaw supports ARM64 natively:


# On Raspberry Pi OS (64-bit)
curl -fsSL https://get.openclaw.dev | bash
openclaw init

For ARM32, use the npm installation method instead.

---

Troubleshooting

Permission Denied with npm


# Option 1: Fix npm prefix
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

# Option 2: Use npx
npx openclaw chat "hello"

Missing Libraries

If you see errors about missing native modules:


# Ubuntu/Debian
sudo apt install -y build-essential python3

# Fedora
sudo dnf groupinstall -y "Development Tools"

Firewall Issues


# Allow gateway port
sudo ufw allow 3777/tcp

# Or with firewalld
sudo firewall-cmd --permanent --add-port=3777/tcp
sudo firewall-cmd --reload

SELinux Blocking OpenClaw

On Fedora/RHEL with SELinux enforcing:


sudo setsebool -P httpd_can_network_connect 1

---

Updating


# npm
npm update -g openclaw

# apt
sudo apt update && sudo apt upgrade openclaw

# Self-update
openclaw self-update

---

Summary

Linux provides the most flexible environment for OpenClaw — from a simple desktop installation to a production server with systemd and Docker. Use the shell script for quick starts, package managers for system integration, and systemd services for always-on messaging and automation.

Related Articles