# How to Self-Host OpenClaw on a Linux VPS

Set up a self-managed OpenClaw gateway with private administration, a deliberately configured provider and a recovery plan for the workspace and state. Start with one bounded workflow before adding integrations.

Last updated: 2026-10-30

**01 / OUTCOME AND SCOPE**

## What this workflow covers

The VPS runs the gateway and the tools you choose to operate. Model inference and messaging providers remain external unless you deliberately configure another supported arrangement. No model subscription, GPU or managed OpenClaw operation is included.

**02 / REQUIREMENTS AND COMPATIBILITY**

## Check the prerequisites first

Confirm compatibility and resources before running a command.

Check the current installer requirements and the available Linux image. The documentation checked for this draft lists supported Node runtime requirements; use its installer guidance rather than a generic assumption that any Node LTS version works. Allow resources for browser and tool processes in addition to the gateway.

**03 / SAFETY AND ACCESS BOUNDARIES**

## Plan permissions and network exposure

Security first: keep credentials, file access and administrative endpoints restricted.

Use a dedicated, non-root application account and grant only the permissions the workflow needs. Keep model-provider keys, repository credentials, messaging tokens and Virtarix management credentials separate. Do not give the agent unrestricted access to unrelated home directories or production systems.

Keep administrative interfaces private. A prompt, repository file, website or incoming message is untrusted input; it should not become authority to read secrets, widen permissions or perform destructive operations. Review tool permissions and require confirmation for consequential actions.

The VPS is the runtime environment, not an included model service. External provider use may create separate charges. Persistent execution must comply with the Acceptable Use Policy, including sustained CPU-use restrictions.

**04 / ENVIRONMENT PREPARATION**

## Prepare a controlled Linux environment

Start on a non-production Linux VPS and record its image, architecture and resource allocation. An administrator should prepare required system packages and recovery access; run the application itself from its own non-root account. Use the current upstream instructions for dependencies rather than installing a guessed runtime version.

Collect the basic environment information:

**Inside the VPS · Prepare a controlled Linux environment — Ubuntu · Bash**

```bash
id
uname -m
cat /etc/os-release
free -h
df -h "$HOME"
command -v curl
```

Stop when a dependency, supported architecture or resource requirement is not met. Do not continue by disabling a protection or silently choosing a different installation path. Keep a record of the version installed and the date of the check.

**05 / INSTALLATION AND COMPATIBILITY RESULT**

## Install OpenClaw

Use the official installer from the application account and inspect the downloaded script before running it:

**Inside the VPS · Install OpenClaw — Ubuntu · Bash**

```bash
curl --fail --silent --show-error --location https://openclaw.ai/install.sh --output install-openclaw.sh
less install-openclaw.sh
bash install-openclaw.sh
openclaw onboard --install-daemon
```

Follow the onboarding prompts for the provider, workspace and access controls. Confirm the installer has established the required runtime and record the installed version.

**06 / APPLICATION CONFIGURATION**

## Configure the application deliberately

Keep the gateway's administration path on loopback or an appropriately protected private network. Configure authentication even when using an SSH tunnel; the tunnel is not a replacement for the gateway's own access checks.

From your local computer, use your actual SSH account and hostname in this private forwarding pattern:

**On your computer · Configure the application deliberately — Ubuntu · Bash**

```bash
read -r -p "SSH user@host: " VPS_SSH_TARGET
ssh -N -L 18789:127.0.0.1:18789 "$VPS_SSH_TARGET"
```

Use the actual port reported by your installation when it differs. Configure only one required integration initially and do not copy provider keys into a public repository.

**07 / FUNCTIONAL VERIFICATION**

## Verify function and the permission boundary

Inspect service health and diagnostics:

**Inside the VPS · Verify function and the permission boundary — Ubuntu · Bash**

```bash
openclaw gateway status
openclaw doctor
```

Confirm the intended provider, authentication and workspace. Run a harmless task inside a test directory, check the logs and verify that an unauthorised client cannot use the gateway. A reachable process is not proof that every channel or tool is ready.

**08 / PERSISTENCE AND DAY-TO-DAY OPERATION**

## Plan persistence and restart behaviour

Use the service installation created during onboarding and verify its behaviour after a logout and a controlled restart. On Linux, a user service may require an administrator to enable lingering for the application account.

Use the framework's own lifecycle commands for the installed service:

**Inside the VPS · Plan persistence and restart behaviour — Ubuntu · Bash**

```bash
openclaw gateway restart
openclaw gateway status
```

Do not create a second competing service unit for the same gateway. Preserve the application account, state path and configuration used by the service.

**09 / TROUBLESHOOTING**

## Troubleshoot without widening the risk

| Symptom | Controlled next check |
| --- | --- |
| Gateway is unreachable | Check the installed service, selected port, tunnel and access controls without exposing the gateway publicly. |
| A model call fails | Check provider access, configured model availability and outbound connectivity. |
| Tools cannot access required files | Inspect the workspace and limited permissions; do not solve the problem by granting root access. |
| Service disappears after logout | Check the user-service manager and approved lingering setup for the service account. |

Stop when the observed result differs materially from the expected state. Collect a redacted error and environment record before choosing a different path.

**10 / UPDATES AND RECOVERY**

## Update and recover with matching state

Before an update, preserve the configuration and application state with a recovery method appropriate to that application. Stop or quiesce writes where consistency requires it. Keep the copy separate from the active server and protect the secrets it may contain.

Record the current binary or package version, runtime dependencies, configuration and service settings. Test the proposed change on a separate environment before changing production. An older executable may not understand a database or state file migrated by a newer version; rollback can require restoring the matching state, not just replacing the binary.

After recovery, repeat the provider, tool, access-control and restart checks. One platform backup and one snapshot are included with the VPS, but independent copies and the application-level restore process remain your responsibility.

**11 / RELATED RESOURCES**

## Related hosting and operating resources

[AI Agent VPS](<https://virtarix.com/solutions/ai-agent-hosting/>) · [AI self-hosting guides](<https://virtarix.com/docs/guides/ai/>) · [Infrastructure](<https://virtarix.com/infrastructure/>) · [Acceptable Use Policy](<https://virtarix.com/docs/legal/acceptable-use-policy/>)

## OpenClaw questions

### Does the gateway require a public administrative port?

No public administrative exposure is assumed. Use the documented private-access approach and retain authentication.

### Is model inference part of the VPS price?

No. The server and external model-provider service are separate.

### Can a backup omit gateway state?

Not when that state is required for recovery. Identify and protect the actual configuration, workspace and state used by your installation.

### Has this procedure been executed on a Virtarix VPS?

No execution test is claimed by this draft. Validate the exact image and application release before production use.
