October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Run OpenClaw With Ollama on a VPS (Secure Linux and Docker Guide)

Run OpenClaw with a local Ollama model on a VPS. This guide explains the architecture, Ansible and Docker Compose routes, resource requirements, secure remote access, onboarding, updates, and troubleshooting.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes—you can run OpenClaw with an Ollama model on a VPS without sending inference to a paid hosted API. Put the OpenClaw Gateway and Ollama service on the VPS, keep the Gateway bound to loopback, and connect from your laptop or phone through the Control UI over an SSH tunnel or Tailscale. The VPS is the source of truth: it holds Gateway state, credentials, conversation data, and the OpenClaw workspace, while your other devices act as clients.

This guide covers the two documented deployment routes—host-based Ansible and Docker Compose—then explains the Ollama hand-off, onboarding, remote access, backups, updates, and common failures. OpenClaw and Ollama integration settings change between releases, so verify the provider name, endpoint, and model tag in the current documentation for the exact versions you install; the authoritative material available for this guide does not establish a single permanent command or alias.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the VPS architecture looks like

There are three moving parts:

  • OpenClaw Gateway: a persistent service that owns OpenClaw state and workspace files on the VPS.
  • Ollama: a local inference service on the same VPS. It downloads and runs the model you select.
  • Client device: a browser, laptop, or phone that reaches the Gateway Control UI through a secure tunnel.

A chat request travels from your client to the Gateway, then to Ollama on the VPS. Model weights and prompts remain on that machine unless another OpenClaw integration is deliberately enabled. Closing your laptop does not stop the Gateway, scheduled work, or the workspace because those live on the server.

OpenClaw’s Linux server guidance explicitly supports running the Gateway on a Linux server or cloud VPS. Its secure default is loopback binding with SSH tunneling or Tailscale Serve rather than exposing the Gateway port to the public internet.

#1 Best Overall
Sale
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
  • AI Performance: 767 AI TOPS
  • OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode)
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Axial-tech fan design features a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • A 2.5-slot design maximizes compatibility and cooling efficiency for superior performance in small chassis

Choose a deployment route

Both routes are official paths. Pick based on where you want the Gateway to run and how you prefer to operate it.

Decision point Host-based Ansible Docker Compose
Gateway location Runs directly on the Linux host under a hardened systemd service. Runs in a container managed by Compose.
Automation Automates the operating-system setup, firewall, Tailscale, runtime, and service hardening. Encodes the application and persistent volumes in a Compose project.
Sandboxing Docker is installed for OpenClaw’s optional agent sandbox; the Gateway itself remains host-based. Container isolation is part of the normal application deployment, with any additional sandbox configuration handled separately.
Updates and rollback Update host packages and OpenClaw through the Ansible procedure, then use systemd status and logs. Pull or build a chosen image, recreate the service, and retain the previous image or volume state for rollback.
Firewall exposure The hardened path configures UFW and Tailscale; the firewall-first setup limits reachability to SSH and Tailscale. You must review published ports in the Compose file and the host firewall yourself.
Persistent data State and workspace are ordinary host directories, which simplifies host-level backups. State and workspace must be mapped to named volumes or host bind mounts and included in backups.
Troubleshooting surface Systemd, Node, pnpm, UFW, Tailscale, and host permissions can all be involved. Container logs, image versions, volume mounts, networking, and host resources add another layer.

Use Ansible when you want a repeatable, security-oriented VPS build and are comfortable administering a Linux host. Use Compose when you already operate containers, want the application definition in one project directory, or need straightforward image-based replacement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Size and prepare the VPS

CPU, memory, and disk

Ollama’s memory requirement depends on the model, quantization, context length, and concurrency. There is no reliable one-size-fits-all figure, and the collected OpenClaw pages do not publish Ollama performance benchmarks. Check the model’s current requirements and leave headroom for the operating system, OpenClaw, caches, and logs.

If you build OpenClaw’s Docker image from source, the Docker documentation calls for at least 6 GB of RAM. A pre-built image avoids that source-build requirement, but it does not remove the RAM needed by Ollama itself. Keep enough disk for the model layers, OpenClaw state, workspace files, Docker layers if applicable, and backups.

Network and access prerequisites

  • A Linux VPS with administrative access and a stable public address or DNS name.
  • SSH access that you can harden before installing application services.
  • A firewall policy that permits only the administration and overlay-network traffic you actually need.
  • Backup capacity separate from the live disk.
  • Optional GPU access if your selected Ollama model benefits from one. Confirm that the VPS platform exposes the required GPU and driver stack; the OpenClaw pages do not provide provider-specific GPU capacity figures.

Region, latency, IPv4 versus IPv6, included bandwidth, backup policy, CPU generation, and total monthly cost vary by VPS plan. Compare those properties for your workload rather than relying on an advertised core count alone.

Prepare SSH first

  1. Create a non-root administrator and install its public key.
  2. Test a second SSH session before changing the first session.
  3. Apply security updates and disable password login or direct root login according to your distribution’s hardening procedure.
  4. Allow SSH through the firewall before enabling the firewall, then verify that a new connection still works.

Do not publish the OpenClaw Gateway port as a substitute for SSH hardening. A public VPS should have its administrative path protected before application onboarding begins.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Route A: install with the hardened Ansible project

The documented Ansible path is designed for a fresh Linux VPS. It installs Tailscale, UFW, Docker CE with Compose v2, Node.js and pnpm, OpenClaw, and a hardened systemd service. Docker is installed as the default backend for OpenClaw’s optional agent sandbox; the Gateway still runs on the host.

Before running it

  • Use a supported Linux distribution and a clean administrative account.
  • Have your Tailscale identity and access policy ready if you want private remote administration.
  • Record the VPS hostname, operating-system release, disk layout, and the intended backup destination.
  • Decide which user should own the OpenClaw workspace and which account Ansible will manage.

Apply the playbook and verify the host

Follow the current Ansible project’s inventory and variable names exactly; they are version-sensitive. After the playbook completes, verify each layer before adding a model:

  1. Confirm the firewall is active and that only the intended SSH and Tailscale paths are reachable.
  2. Confirm the Tailscale node appears in your tailnet and that you can reach the VPS privately.
  3. Check the OpenClaw systemd unit’s active state and recent journal output.
  4. Check the installed Node version. The current OpenClaw install overview requires Node 24.16 or newer, or Node 26.1 or newer, and recommends Node 26.
  5. Confirm Docker and Compose v2 are available if you will use the agent sandbox.

Keep the Ansible variables and the resulting package versions in your deployment notes. They are the fastest way to reproduce the machine or explain a later change.

Route B: install with Docker Compose

The Compose route places the Gateway in a container and keeps its state in persistent mounts. It requires Docker Engine or Docker Desktop and Docker Compose v2.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a pre-built image or source build

A pre-built image is the practical choice on a small VPS because it avoids the documented 6 GB RAM minimum for a local source-image build. A source build can be useful when you need a specific revision or are testing a change, but reserve at least that amount of memory before starting and leave additional capacity for Ollama.

Create and protect the project directory

  1. Make a directory readable only by the administrator or service account that will manage the deployment.
  2. Place the official Compose file and its environment file there, using the variable names from the release you selected.
  3. Review every published port. Do not publish the Gateway directly to all interfaces unless you have a deliberate network and authentication design.
  4. Ensure the state and workspace paths are persistent mounts rather than container-layer files.
  5. Run the project’s onboarding script, then start the stack with the Compose v2 command specified by that release.

The Docker documentation describes an onboarding flow that generates a Gateway token and exposes the Control UI on the configured port. Save the generated token in a password manager; do not put it in shell history, a public repository, or an issue report.

Verify the container

  • Inspect Compose service status and container logs.
  • Confirm the persistent mounts contain the expected OpenClaw state and workspace directories.
  • Confirm the Gateway listens only on the interface you intended.
  • Open the Control UI through an SSH tunnel or Tailscale before considering a wider bind address.

Install Ollama on the VPS

Install Ollama using its current official Linux instructions for the distribution on your VPS. The installer, service unit, package behavior, and model commands can change, so do not copy an old command from an unrelated tutorial.

Rank #2
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card | PCIe 5.0, HDMI/DP 2.1, 3.6-slot, Military-grade Components, Protective PCB Coating, Axial-tech Fans
  • Powered by the NVIDIA Blackwell architecture and DLSS 4. System Requirements: Minimum 850W PSU with 16-pin 12V-2x6 (12VHPWR) connector required. Verify before purchasing.
  • Military-grade components deliver rock-solid power and longer lifespan for ultimate durability. Compatibility: 348mm (13.7") length, 3.6 slots, 4.3 lbs. Confirm case clearance and slot spacing. GPU bracket included.
  • Protective PCB coating helps protect against short circuits caused by moisture, dust, or debris
  • 3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans
  • Phase-change GPU thermal pad helps ensure optimal thermal performance and longevity, outlasting traditional thermal paste for graphics cards under heavy loads

Validate Ollama independently

  1. Start the Ollama service using the method documented for the release you installed.
  2. Download one model that fits the VPS’s available memory and disk.
  3. Run a minimal local generation test from the VPS itself.
  4. Check the service logs while the model loads and responds.
  5. Record the exact Ollama version and model tag.

Do this before configuring OpenClaw. If a local generation fails, adding the Gateway only makes diagnosis harder. Watch for out-of-memory kills, insufficient disk space, slow model loading, and a service bound to an address that the Gateway cannot reach.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not assume a permanent endpoint or alias

The authoritative pages collected for this topic do not establish a single OpenClaw provider name, Ollama endpoint URL, environment variable, or model alias that is guaranteed across releases. OpenClaw’s integration settings and Ollama’s defaults must therefore be checked together for the versions you installed. Use the current OpenClaw provider documentation and the current Ollama documentation, then record the exact values in your deployment notes. Publishing an endpoint from an older release as if it were universal is a common cause of a healthy Ollama service appearing unavailable to OpenClaw.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Connect OpenClaw to the local model

Complete onboarding

Open the Control UI through your secure tunnel, run the release’s onboarding flow, and select the local Ollama provider using the exact provider label and model tag shown in the current documentation. Keep the Gateway and Ollama on the same VPS where possible; a local service address avoids exposing model inference to the internet.

When the UI asks for authentication, use the token generated by the Docker onboarding flow or the credential configured by the host installation. If the release supports environment-file configuration, protect that file with restrictive permissions and restart the relevant service after changing it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run a minimal test

  1. Send a short prompt that does not require tools, files, or a long context.
  2. Confirm that the response is produced by the selected Ollama model rather than a fallback provider.
  3. Check Gateway and Ollama logs at the same time if the request fails.
  4. Try a second request after the model is warm to distinguish initial-load latency from a connection problem.

Only after this test succeeds should you configure automations, channels, agent tools, or a larger context window. A model that barely fits during a one-message test may fail when OpenClaw adds tool definitions or concurrent jobs.

Secure remote access

Preferred design: loopback plus SSH

Keep the Gateway bound to loopback whenever you can. From your laptop, create a local forward to the VPS’s loopback listener using your SSH client and the Gateway port configured by your installation. The OpenClaw documentation commonly refers to port 18789; confirm the actual port in your release before forwarding it.

Once the tunnel is established, open the Control UI at the local address specified by the tunnel. The connection is encrypted inside SSH, and the Gateway does not need a public listener.

Private access with Tailscale

Tailscale is included in the hardened Ansible path. You can reach the VPS over its tailnet address and use Tailscale Serve for the Control UI, keeping the service off the public interface. Apply your tailnet ACLs so only the devices and users that need OpenClaw can reach it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If you bind to a LAN or tailnet interface

A non-loopback bind increases the reachable attack surface. OpenClaw’s guidance requires a shared Gateway token or password when binding to lan or tailnet, unless a trusted proxy performs authentication. Configure gateway.auth.token or gateway.auth.password according to the current release’s configuration schema, and protect the secret as carefully as an SSH key.

Do not expose port 18789 directly to the public internet without the documented authentication and network controls. A firewall rule that merely hides the port from casual scans is not an authentication system.

Backups, updates, and routine operations

Back up the right data

  • OpenClaw Gateway configuration and credentials, encrypted at rest.
  • The complete OpenClaw workspace, including files created by agents.
  • Compose files, environment files, and Ansible inventory or variable files.
  • Any local scripts, automation definitions, and service overrides.
  • Deployment notes containing the OpenClaw release, Node version, Ollama version, and model tag.

Do not treat a downloaded Ollama model as a replacement for configuration and workspace backups. Models can usually be downloaded again; your state and credentials cannot.

Monitor resources

Track disk usage, memory pressure, CPU load, and swap activity. Model downloads can fill a small volume, while context growth and concurrent jobs can exhaust RAM even when the model initially fit. Alert on failed systemd units or restarting containers, and retain enough logs to identify whether a failure began in OpenClaw, Ollama, Docker, or the host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Update deliberately

Read the release notes for OpenClaw, Ollama, Node, Docker, and the Linux distribution before upgrading. Back up first, update one layer at a time, and record the resulting versions. For Compose, retain the previous image reference until the new container passes a chat test. For Ansible, keep the prior inventory and variables so you can reproduce the last known-good host configuration.

Quick Recap

SaleBestseller No. 1
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1b, 2.5-slot, Axial-tech Fans, 0dB Technology, Dual BIOS
AI Performance: 767 AI TOPS; OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode); Powered by the NVIDIA Blackwell architecture and DLSS 4
$771.99
Bestseller No. 2
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card | PCIe 5.0, HDMI/DP 2.1, 3.6-slot, Military-grade Components, Protective PCB Coating, Axial-tech Fans
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card | PCIe 5.0, HDMI/DP 2.1, 3.6-slot, Military-grade Components, Protective PCB Coating, Axial-tech Fans
3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans; Auto-Extreme precision automated manufacturing helps ensure higher reliability
$1,829.99

Troubleshooting by symptom

The Control UI will not load

  • Verify the Gateway service or container is running.
  • Check that the tunnel targets the actual configured port and loopback address.
  • Inspect firewall rules and Tailscale ACLs.
  • For Compose, confirm the port is published only as intended and that the container is healthy.

OpenClaw cannot reach Ollama

  • Run a local Ollama test on the VPS first.
  • Confirm the provider configuration matches the current OpenClaw release.
  • Check whether the Gateway is host-based or containerized; a container may need an explicitly documented route to a host service.
  • Review both logs for connection refusals, wrong ports, authentication errors, and model-name mismatches.

The model crashes or responds extremely slowly

  • Check available RAM and whether the kernel killed the process.
  • Use a smaller or more heavily quantized model.
  • Reduce context length and concurrency in the supported OpenClaw settings.
  • Allow the first request time to load the model, then compare warm-request latency.

The service disappears after a reboot

  • Confirm the systemd unit is enabled on the Ansible or host installation.
  • Confirm the Compose project is configured to restart and that Docker starts at boot.
  • Check that model and workspace directories are mounted from persistent storage.
  • Review boot-time logs for dependency, permissions, or mount failures.

Practical decision checklist

  • Choose Ansible if you want a hardened, mostly automated Linux build with Tailscale, UFW, Node, OpenClaw, and a systemd service.
  • Choose Docker Compose if container operations, image pinning, and volume-based deployment fit your existing workflow.
  • Choose a VPS with enough RAM for the Ollama model plus OpenClaw overhead; the 6 GB figure applies to a local OpenClaw Docker source build, not to every Ollama workload.
  • Keep the Gateway on loopback and use SSH or Tailscale for administration.
  • Use a Gateway token or password whenever you bind beyond loopback, unless a trusted proxy handles authentication.
  • Verify the exact Ollama endpoint, provider label, environment variable, and model tag against the current release documentation before publishing or automating them.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.