Home » Openclaw» Install OpenClaw on Ubuntu 24.04 VPS — Beginner’s Technical Guide

Install OpenClaw Ubuntu 24.04 Server

This guide explains how to install openclaw ubuntu 24.04 server on a generic VPS using Docker and Node.js. Direct answer: set up an Ubuntu 24.04 VPS, install Docker and Docker Compose, prepare the OpenClaw configuration and environment, then run OpenClaw in containers. Below are prerequisites, tested commands, an update and security section, a screenshots checklist, and troubleshooting tips for beginners.

Prerequisites and choosing a VPS

Before you begin, ensure you have:

  • A VPS running Ubuntu 24.04 with root or sudo access (choose Any VPS provider that meets the specs).
  • SSH access and a basic familiarity with the command line.
  • At least one non-root user with sudo privileges (recommended for security).
  • Docker, Docker Compose, and Node.js installed (commands below).
  • Firewall configured to allow required ports (HTTP/HTTPS, app port).

If you need guidance on picking a host, see our hosting notes at best hosting. For minimum server requirements and tiers see server requirements.

Preparing to install openclaw ubuntu 24.04 server

Start from a fresh Ubuntu 24.04 VPS. The commands below assume a single-server deployment using Docker Compose. Replace example values (USERNAME, APP_DIR) with your own.

# update system and create a user
sudo apt update && sudo apt upgrade -y
sudo adduser openclawuser
sudo usermod -aG sudo openclawuser
su - openclawuser

# install essential tools
sudo apt install -y curl git apt-transport-https ca-certificates gnupg lsb-release

Install Docker, Docker Compose, and Node.js

Install Docker and Docker Compose from the official repositories, then install Node.js LTS for local scripts or hooks.

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker

# Install Docker Compose plugin (if not present)
sudo apt update
sudo apt install -y docker-compose-plugin

# Verify Docker
docker --version
docker compose version

# Install Node.js (LTS)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v

Create OpenClaw deployment files

Choose a directory for the application and create a minimal docker-compose.yml. This example uses a generic OpenClaw image and a PostgreSQL database container. Adjust image names and environment variables for your OpenClaw build.

mkdir -p ~/openclaw && cd ~/openclaw
cat > docker-compose.yml <<'YAML'
version: '3.8'
services:
  db:
    image: postgres:15
    restart: unless-stopped
    environment:
      POSTGRES_USER: openclaw
      POSTGRES_PASSWORD: change_me
      POSTGRES_DB: openclaw
    volumes:
      - db-data:/var/lib/postgresql/data

  openclaw:
    image: openclaw/openclaw:latest
    restart: unless-stopped
    depends_on:
      - db
    environment:
      DATABASE_URL: postgres://openclaw:change_me@db:5432/openclaw
      NODE_ENV: production
    ports:
      - "3000:3000"
    volumes:
      - openclaw-data:/usr/src/app/data

volumes:
  db-data:
  openclaw-data:
YAML

Note: Replace openclaw/openclaw:latest with your OpenClaw image tag if you have a custom build. Keep secrets out of the file in production—use Docker secrets or environment management.

Environment setup and initial run

Create a .env or supply environment variables securely. Then start the stack and run initial migrations or setup tasks.

# Example .env (do NOT commit to VCS)
cat > .env <<'ENV'
DATABASE_URL=postgres://openclaw:change_me@db:5432/openclaw
NODE_ENV=production
ENV

# Start containers
docker compose up -d

# Check logs for the openclaw service
docker compose logs -f openclaw

If OpenClaw requires migrations or seed commands, run them with:

# Run migrations inside the container (example)
docker compose exec openclaw npm run migrate

Resource tiers and performance guidance

When selecting a VPS or sizing instances, consider tiers based on the workload:

  • Development / testing: 1 vCPU, 1–2 GB RAM — suitable for local trials and small dev environments.
  • Small production: 2 vCPU, 4 GB RAM — acceptable for low-traffic or lightweight automation tasks.
  • Medium production: 4 vCPU, 8–16 GB RAM — recommended when running multiple workers, background jobs, or moderate concurrency.
  • High-throughput: 8+ vCPU, 32+ GB RAM and vertical scaling — design for heavy automation, large queues, or many integrations.

CPU, RAM, and disk I/O affect task throughput. For persistent data, prefer SSD-backed volumes. For multi-service setups, use separate DB tiers when possible.

Update section

Keep OpenClaw and system packages up to date. A safe update routine:

# Update OS packages
sudo apt update && sudo apt upgrade -y

# Pull new images and restart
cd ~/openclaw
docker compose pull
docker compose up -d --remove-orphans

# Optional: run migrations if the new release requires them
docker compose exec openclaw npm run migrate

Test updates in a staging environment before applying to production. For zero-downtime patterns, consider rolling updates with multiple instances behind a load balancer.

Security best practices

Secure your OpenClaw deployment:

  • Create a non-root user and avoid running containers as root where possible.
  • Use a firewall (ufw) to restrict access to necessary ports only.
  • Enable TLS for public endpoints; terminate TLS at a reverse proxy like Nginx or a managed load balancer.
  • Store secrets using Docker secrets, environment variable vaults, or your provider's secret manager.
  • Regularly back up database volumes and configuration files.

For deployment hardening and SSH best practices, see our VPS hardening guide at secure VPS.

Screenshots checklist

When documenting or verifying an installation, capture these screenshots or confirmations:

  • SSH session showing the Ubuntu 24.04 banner and hostname.
  • Output of docker --version and docker compose version.
  • Contents of your docker-compose.yml (redact secrets).
  • Docker container list: docker ps showing openclaw and db containers.
  • OpenClaw startup logs showing successful initialization.

Troubleshooting

Common issues and how to resolve them:

  • Port conflicts: If port 3000 is in use, change the host port mapping in docker-compose.yml or stop the conflicting service.
  • Database connection errors: Verify DATABASE_URL, network aliases, and that the database container initializes successfully. Check docker compose logs db.
  • Permission denied when accessing Docker: Ensure your user is in the docker group or use sudo for Docker commands.
  • Service failing to start after update: Review logs (docker compose logs openclaw), revert to prior image tag if needed, and run migrations manually.
  • High memory usage: Inspect container memory with docker stats and consider increasing the VPS RAM or optimizing worker concurrency.

When things go wrong: quick commands

# View combined service status
docker compose ps

# View logs for a service
docker compose logs --tail=200 openclaw

# Restart a single service
docker compose restart openclaw

# Recreate containers using new images
docker compose pull && docker compose up -d --remove-orphans

Decision support: choosing Any VPS provider

Any VPS provider that offers Ubuntu 24.04 images, SSD storage, and predictable network performance will work. For guidance comparing feature trade-offs such as snapshots, backups, and managed databases, see our hosting comparison at best hosting. Choose a tier aligned with the resource guidance above.

Final recommendation and next steps

For a stable start: pick a small production tier (2 vCPU, 4 GB RAM), secure the server following the secure VPS checklist, and use Docker Compose as shown. Test your deployment, then scale to a medium or larger tier if you need more concurrency or background workers. If you already have a preferred host, use Any VPS provider that supports snapshots and backups for safer updates.

When you're ready to proceed, Deploy on your VPS and follow this guide step by step. If you run into issues, consult the troubleshooting section above or capture the recommended screenshots and logs before seeking help.

Clara
Written by Clara

Clara is an OpenClaw specialist who explores everything from autonomous agents to advanced orchestration setups. She experiments with self-hosted deployments, API integrations, and AI workflow design, documenting real-world implementations and performance benchmarks. As part of the AutomationCompare team, Clara focuses exclusively on mastering OpenClaw and helping developers and founders deploy reliable AI-driven systems.

Keep Reading

Scroll to Top