Skip to content

Self-hosting OpenClaw on Linux desktop (Ubuntu and Fedora)

Install OpenClaw on a Linux desktop or workstation — Node 24 via NodeSource on Ubuntu and Fedora, ~/.openclaw layout, a user-systemd unit at ~/.config/systemd/user/, journalctl access.

You’ve been running OpenClaw (openclaw.ai) on the company laptop, and now you want it on your Linux workstation too — the one that’s actually on most of the day, attached to two monitors, plugged into the LAN, and not roaming through hotel Wi-Fi. This is the install path for Ubuntu 24.04 LTS and Fedora 40+: Node 24 from a trusted source, a clean ~/.openclaw/ directory, and a user-scoped systemd unit so the agent comes back after every reboot without touching root.

Scenario

A daily-driver Linux desktop. You log in graphically, you keep terminals open all day, you want the personal agent on whenever you are. You don’t want it running as root, you don’t want it managed by the system instance of systemd, and you don’t want a docker container in the middle when the binary works directly. Both Ubuntu (apt) and Fedora (dnf) are covered below — the OpenClaw side is identical, only the Node install path differs.

Outcome and prereqs

When this is done you’ll have:

  • Node 24 from NodeSource (Ubuntu) or the official Fedora Node 24 module (Fedora 40+).
  • openclaw installed globally with no EACCES errors.
  • ~/.openclaw/ with openclaw.json, .env, workspace/, memory/, and logs/.
  • A user-systemd unit at ~/.config/systemd/user/openclaw.service, enabled with loginctl enable-linger so the agent runs while you’re logged out.
  • journalctl --user -u openclaw returning live logs.

Prereqs:

  • Ubuntu 24.04 LTS or 22.04 LTS, or Fedora 40+.
  • sudo rights for the Node install (one step).
  • 1.5 GB free disk minimum (Node, the global module tree, and a few weeks of workspace state).
  • One model provider — Anthropic API key, OpenAI API key, or local Ollama at 127.0.0.1:11434.

Time and resource footprint

About 15 minutes attended. Steady-state RAM under 250 MB while idle; CPU is essentially zero until you talk to it. Disk grows slowly with memory and conversation history — budget ~1 GB after the first month of normal use.

Step 1 — Install Node 24

Ubuntu (24.04 / 22.04):

curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version    # v24.x.x
npm --version

nodesource is the canonical Node distribution for Debian/Ubuntu; the script registers the repo and installs the right keyring.

Fedora 40+:

sudo dnf module reset nodejs
sudo dnf module enable -y nodejs:24
sudo dnf install -y nodejs npm
node --version    # v24.x.x

Fedora 40 and 41 ship Node 24 as a stream of the nodejs module — dnf module selects it.

You can also use nvm on either distribution if you need to juggle Node versions across projects. For a dedicated workstation, the package-manager route is simpler to keep patched.

Step 2 — Install OpenClaw

curl -fsSL https://openclaw.ai/install.sh | bash
sudo npm i -g openclaw
openclaw --version

The npm i -g command needs write access to the npm global prefix; on Ubuntu/Fedora that’s typically /usr/lib/node_modules, hence the sudo. If you prefer to avoid sudo for npm, point npm at a user-owned prefix:

mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm i -g openclaw

Either path works; the rest of the article assumes openclaw is on PATH.

Step 3 — Onboard

openclaw onboard

Pick your model (anthropic/claude-sonnet-4-5 is the common default), paste your API key, accept the daemon install when prompted. Onboarding writes:

~/.openclaw/
├── openclaw.json
├── .env             (mode 0600)
├── workspace/
│   ├── AGENTS.md
│   ├── SOUL.md
│   ├── TOOLS.md
│   └── skills/
├── memory/
└── logs/

Lock the .env:

chmod 600 ~/.openclaw/.env
ls -l ~/.openclaw/.env
# -rw-------  1 you  you  ###  May 14 14:32 .env

The minimal openclaw.json is one block (openclaw README):

{
  "agent": {
    "model": "anthropic/claude-sonnet-4-5"
  }
}

Step 4 — Run the gateway in the foreground once

openclaw gateway --port 18789 --verbose

You should see the gateway bind on 127.0.0.1:18789. In another terminal:

openclaw agent --message "What is my distro?" --thinking high

The agent should run lsb_release -a or read /etc/os-release and produce a real answer. Ctrl-C the gateway — Step 5 makes it persistent.

Step 5 — Install the user-systemd unit

Write the unit at ~/.config/systemd/user/openclaw.service:

[Unit]
Description=OpenClaw personal AI agent gateway
Documentation=https://openclaw.ai
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/openclaw gateway --port 18789
Restart=on-failure
RestartSec=5

# Read env from the OpenClaw env file
EnvironmentFile=%h/.openclaw/.env

# Hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=%h/.openclaw
PrivateTmp=true

# Resource limits
MemoryMax=2G
TasksMax=512

# Logs go to the journal
StandardOutput=journal
StandardError=journal
SyslogIdentifier=openclaw

[Install]
WantedBy=default.target

After=network-online.target makes sure the gateway only starts once the network is up, which matters because the first thing it does is reach for the model provider. Restart=on-failure means it’ll recover from a crash but stay down if you explicitly stop it. ProtectHome=read-only plus ReadWritePaths=%h/.openclaw means the agent process itself can only write under ~/.openclaw/ — useful when you start running custom skills that touch the filesystem. The semantics of every directive above are in systemd.service(5) and systemd.exec(5).

If you used a user-owned npm prefix in Step 2, replace /usr/bin/openclaw with the actual path (which openclaw tells you).

Enable and start it:

systemctl --user daemon-reload
systemctl --user enable --now openclaw.service
systemctl --user status openclaw.service

A healthy status shows Active: active (running) and the most recent log lines.

Step 6 — Linger so it runs while you’re logged out

By default, user-systemd services stop when you log out. To keep OpenClaw running on a desktop you sometimes log out of (or a workstation you connect to over SSH):

sudo loginctl enable-linger "$USER"
loginctl show-user "$USER" | grep Linger
# Linger=yes

enable-linger keeps the user manager alive after logout, which is exactly the supported pattern for long-running user services per loginctl(1).

Verification

openclaw doctor

openclaw doctor should report a green gateway, a healthy model, and the chat integrations you’ve paired. If you haven’t paired any yet, that’s expected — the docs show openclaw pairing approve as the way to wire Telegram/Signal/WhatsApp/Slack/Discord later.

Confirm listener:

ss -lntp 'sport = :18789'
# State  Recv-Q  Send-Q  Local Address:Port  Peer Address:Port  Process
# LISTEN 0       511     127.0.0.1:18789     0.0.0.0:*          users:(("node",pid=####,fd=##))

Tail the journal:

journalctl --user -u openclaw -f

Kill the PID, watch systemd restart it within five seconds (matching RestartSec=5).

Rollback

systemctl --user disable --now openclaw.service
rm ~/.config/systemd/user/openclaw.service
systemctl --user daemon-reload

# Ubuntu
sudo apt-get remove -y nodejs   # only if no other Node app depends on it
# Fedora
sudo dnf remove -y nodejs

# Optional: archive the stateful directory before deleting
mv ~/.openclaw ~/.openclaw.disabled.$(date +%F)

sudo loginctl disable-linger "$USER" if you no longer need any user services running while logged out.

Troubleshooting

systemctl --user fails with “Failed to connect to bus”. You’re SSHed in as a non-login user; loginctl enable-linger "$USER" from a console session, then reconnect. As a quick check: echo $XDG_RUNTIME_DIR should be /run/user/<uid>.

Service crashes on start with EnvironmentFile= path is not absolute. systemd treats %h as the home directory — confirm the unit file is in ~/.config/systemd/user/ (not the system path). If you moved it to /etc/systemd/system/, you have to hardcode the full path.

Port 18789 already in use. Another OpenClaw instance, or you onboarded twice. ss -lntp 'sport = :18789' shows the PID — kill the stray and systemctl --user restart openclaw.

SELinux denials on Fedora. Rare for user services, but check with sudo ausearch -m AVC -ts recent | grep openclaw. If denied, the simplest fix is to set the ~/.openclaw/ directory to the user_home_t context: restorecon -R ~/.openclaw. Don’t write a global setenforce 0.

openclaw agent returns text answers but never runs commands. Shell tool isn’t enabled. openclaw onboard again and explicitly accept shell-tool permission, or edit the relevant block in openclaw.json and restart the service.

Node version mismatch after a dnf upgrade. Fedora may switch the active nodejs: module stream. sudo dnf module reset nodejs && sudo dnf module enable nodejs:24 && sudo dnf install -y nodejs re-pins.

Production-readiness

For a workstation, “production” means the agent survives reboots, contained to its directory, and observable.

  • ~/.openclaw/ backed up by your existing backup tool (restic, borg, deja-dup). Don’t back up logs/.
  • journalctl --user -u openclaw --since "24 hours ago" | grep -iE 'error|fatal' as a daily sanity check — easy to wire to a cron job that emails you anything matching.
  • loginctl enable-linger always on.
  • API keys in ~/.openclaw/.env rotated quarterly; OpenAI and Anthropic both support scheduled expiry.
  • A second machine paired to the same chat channels so a single workstation outage doesn’t black out remote control.

For organizations that want this on engineer workstations across a fleet, talk to a senior operator at Stack Harbor about your self-hosted OpenClaw rollout.

Sources

  • OpenClaw home page and install one-liner — https://openclaw.ai.
  • OpenClaw README, install paths, daemon flags — https://github.com/openclaw/openclaw.
  • NodeSource Node.js distributions — https://github.com/nodesource/distributions.
  • systemd.service(5), systemd.exec(5), loginctl(1) man pages.
  • Fedora Node.js module documentation — https://docs.fedoraproject.org/en-US/quick-docs/node-js/.

Last verified on OpenClaw current (May 2026).