Installing OpenClaw on a VPS

Full control with your own VPS from easyname

With a VPS from easyname, you have full control over your server – flexible, scalable and operated in an environmentally conscious manner in ISO-certified data centres in Austria. Ideal for your applications, projects and maximum performance.

Close-up of a blue-lit server rack with multiple drive bays and front-panel indicators.

Overview

  • System used: Debian 12 64-bit
  • User account: I am performing all actions as ‘root’
  • Duration: approx. 20 minutes
  • Difficulty: Easy. Just copy the code 😉
  • Special features:
  • This guide is based on the following instructions: Installing Traefik reverse proxy on a VPS
    These instructions must be followed first.
  • Installation of Docker / Docker Compose is required here.
  • You will need an API key for an AI system, as OpenClaw is entirely dependent on the AI

1. Installing OpenClaw

1.1 Introduction

OpenClaw is a relatively new open-source project that has attracted a great deal of attention since its release. Broadly speaking, it allows you to run an AI agent that chats with you via integrations and performs tasks using connected AI models (e.g. generating text, triggering simple workflows).

Important: OpenClaw is entirely dependent on an AI model. Without an AI backend, it does not ‘think’ for itself, and as every response is generated via an external AI, every request incurs usage-based costs with the respective AI provider.

In our specific setup, the aim is to deploy OpenClaw via Traefik. We are using Google Gemini as our AI provider and also want to integrate Telegram so that we can interact with OpenClaw conveniently via Telegram chat.

1.2 Information on YML files

With YML files, it is very important that all lines are correctly indented. Lines MUST always be indented using the space bar. They must NOT contain any tabs. You can always have the following code ‘checked’ online. Most errors are caused by incorrect formatting. One service for checking is, for example: https://codebeautify.org/yaml-validator

1.3 Preparation

These instructions are based on the current Debian 12 operating system. We will set up OpenClaw using Docker. This will allow us to perform very quick updates and a rapid installation later on.

To run OpenClaw alongside other services on our server, we’ll be using the Traefik reverse proxy. You can find the guide for this here:  Installing Traefik reverse proxy on a VPS

1.3.1 Create a directory

We will create a new directory in which we will later store all OpenClaw data. To do this, enter the following in the console:

mkdir -p /opt/containers/openclaw

You can also use a different directory here. However, you will then need to adapt the entire guide accordingly.

1.3.2 Create docker-compose.yml

Now we can begin the actual “installation” of OpenClaw. To do this, open the following file:

nano /opt/containers/openclaw/docker-compose.yml

Now copy the following code into the file. This code is our blueprint for our OpenClaw container.

services:
 openclaw-gateway:
   image: ${OPENCLAW_IMAGE}
   environment:
     HOME: /home/node
     TERM: xterm-256color
     OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
   volumes:
     - ./config:/home/node/.openclaw
     - ./workspace:/home/node/.openclaw/workspace
   env_file:
     - .env
   init: true
   restart: unless-stopped
   command:
     [
       "node",
       "dist/index.js",
       "gateway",
       "--allow-unconfigured",
       "--bind",
       "${OPENCLAW_GATEWAY_BIND:-0.0.0.0}",
       "--port",
       "18789",
     ]
   healthcheck:
     test:
       [
         "CMD",
         "node",
         "-e",
         "fetch('http://127.0.0.1:18789/healthz').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
       ]
     interval: 30s
     timeout: 5s
     retries: 5
     start_period: 20s
   labels:
     - "traefik.enable=true"
     - "traefik.http.routers.openclaw.entrypoints=http"
     - "traefik.http.routers.openclaw.rule=Host(`openclaw.euredomain.de`)"
     - "traefik.http.middlewares.openclaw-https-redirect.redirectscheme.scheme=https"
     - "traefik.http.routers.openclaw.middlewares=openclaw-https-redirect"
     - "traefik.http.routers.openclaw-secure.entrypoints=https"
     - "traefik.http.routers.openclaw-secure.rule=Host(`openclaw.euredomain.de`)"
     - "traefik.http.routers.openclaw-secure.tls=true"
     - "traefik.http.routers.openclaw-secure.tls.certresolver=http"
     - "traefik.http.routers.openclaw-secure.service=openclaw"
     - "traefik.http.services.openclaw.loadbalancer.server.port=18789"
     - "traefik.docker.network=proxy"
     - "traefik.http.routers.openclaw-secure.middlewares=secHeaders@file,openclaw-auth"
     - "traefik.http.middlewares.openclaw-auth.basicauth.users="
   networks:
     - proxy

 openclaw-cli:
   image: ${OPENCLAW_IMAGE}
   env_file:
     - .env
   network_mode: "service:openclaw-gateway"
   cap_drop:
     - NET_RAW
     - NET_ADMIN
   security_opt:
     - no-new-privileges:true
   environment:
     HOME: /home/node
     TERM: xterm-256color
     OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN:-}
     BROWSER: echo
   volumes:
     - ./config:/home/node/.openclaw
     - ./workspace:/home/node/.openclaw/workspace
   stdin_open: true
   tty: true
   init: true
   entrypoint: ["node", "dist/index.js"]
   depends_on:
     - openclaw-gateway

networks:
 proxy:
   external: true 

1.3.3 Creating an env file

Now let’s create a file containing our settings. To do this, enter the following:

nano /opt/containers/openclaw/.env 

Inhalt:

# ----------------------------------------------------------------------------- 
# Gateway auth + Image 
# ----------------------------------------------------------------------------- 
OPENCLAW_GATEWAY_TOKEN=change-me-to-a-long-random-token 
OPENCLAW_IMAGE=ghcr.io/openclaw/openclaw:latest 
OPENCLAW_CONFIG_DIR=./config 
OPENCLAW_WORKSPACE_DIR=./workspace 

You can customise the OPENCLAW_IMAGE parameter as you wish. However, in this case we are using the official OpenClaw image.

1.3.4 First configuration script

To save a bit of work, we’ll create a script that assigns our domain, username and password, ensuring that OpenClaw is accessible and secure.

 nano /opt/containers/openclaw/setup.sh 

Content:

#!/bin/bash 
 
if ! command -v htpasswd &> /dev/null; then 
    echo "htpasswd is not installed. Install apache2-utils..." 
    sudo apt-get update && sudo apt-get install -y apache2-utils 
fi 
 
read -p "Please enter your desired domain (e.g. openclaw.mydomain.co.uk): " USER_DOMAIN 
 
sed -i "s/Host(\`openclaw.yourdomain.co.uk\`)/Host(\`$USER_DOMAIN\`)/g" docker-compose.yml 
echo "The domain has been updated to $USER_DOMAIN in docker-compose.yml." 
 
NEW_TOKEN=$(openssl rand -hex 32) 
sed -i "s/^OPENCLAW_GATEWAY_TOKEN=change-me-to-a-long-random-token/OPENCLAW_GATEWAY_TOKEN=$NEW_TOKEN/g" .env 
echo "A secure gateway token has been generated and stored in the .env file." 
 
echo "---" 
echo "Setting up the OpenClaw login" 
read -p "Please enter a username for the dashboard: " AUTH_USER 
read -s -p "Please enter a secure password: " AUTH_PASS 
echo "" 
 
AUTH_STRING=$(htpasswd -nb "$AUTH_USER" "$AUTH_PASS" | sed -e s/\\$/\\$\\$/g) 
 
sed -i "s|^      - \"traefik.http.middlewares.openclaw-auth.basicauth.users=\".*|      - \"traefik.http.middlewares.openclaw-auth.basicauth.users=$AUTH_STRING\"|g" docker-compose.yml 
 
echo "Basic Auth credentials have been successfully stored in docker-compose.yml." 
echo "Setup complete!" 

Now let’s make the script executable and run it:

chmod +x /opt/containers/openclaw/setup.sh 
cd /opt/containers/openclaw/ 
./setup.sh 

1.3.5 Download the official setup script

Now let’s download the official OpenClaw configuration script.

cd /opt/containers/openclaw 
wget -O docker-setup.sh https://raw.githubusercontent.com/openclaw/openclaw/main/docker-setup.sh 
chmod +x docker-setup.sh 

2. Generate an AI API key

OpenClaw offers a wide range of supported AI systems. Here is an overview:

Vertical list of model/auth providers with radio buttons; Google is selected.

Later on, you’ll need to enter an API key for an AI system in order to use OpenClaw. In this example, we’re using Google Gemini. To do this, go to the following URL: https://aistudio.google.com/

Register there and you will then be able to view your API key. You will also see the costs you will incur for requests to Gemini.

3. Add a communication gateway (optional)

OpenClaw offers a wide range of gateways through which it can communicate.

Terminal-style menu listing multiple chat channels with selectable options.

Essentially, OpenClaw provides a website, so you don’t need any additional gateway. In this example, we’re using Telegram, as it’s free and very easy to set up.

First, create a Telegram account or log in to your existing account.

Then search for the following contact: “@BotFather”.

Search bar with @botfather; BotFather card showing avatar, blue check, 'Choose a bot from the list below:' and an 'Öffnen' button.

It’s important to make sure you use the service with the ‘blue tick’, as there are many fake services out there.

Type “/start” to see an overview of all parameters.

Telegram BotFather chat showing commands to create and manage bots, including Edit Bots, Bot Settings, Web Apps, and Games.

Select “/newbot” here and give your bot a name. You can search for the bot using this name later. It is important that the name ends with “bot”.

Telegram chat shows bot setup messages; green chat bubbles with avatars, red outline around 8782.

If everything was correct, you should receive a confirmation message containing an HTTP API token. We will need this later for OpenClaw.

4. Start the OpenClaw setup

Important note:
OpenClaw takes a long time to load at several points. It is important that you simply wait a few minutes here until the dialogue continues. In this guide, the images always show you which dialogues or outputs you need to wait for before you can continue.

Now let’s start setting up OpenClaw. To do this, we need the API keys created earlier.

cd /opt/containers/openclaw 
set -a && source .env && set +a && ./docker-setup.sh 

In the first step, select “yes”:

Pixel-art OPENCLAW logo above a dark terminal window with a bordered security warning and a Yes/No confirmation.

Here, we select ‘Manual’ so that we can configure all the settings:

Dark panel with three items: Onboarding mode, QuickStart, Manual (Configure port, network, tailscale, and auth options).

You can simply confirm the Workspace Directory:

Terminal prompt showing 'Workspace directory' and the path /home/node/.openclaw/workspace with a cursor.

Now you can choose your AI system. In our case, it’s Google.

Vertical list of model/auth providers; Google (Gemini API key + OAuth) is selected (green dot).

Here, we select ‘Google Gemini API key’:

Dark UI menu titled 'Google auth method' with items: Google Gemini API key, Google Gemini CLI OAuth, Back.

Now we select the option to paste the API key directly (“Paste API key now”):

Prompt with two API key options: Paste API key now (stores in OpenClaw config) or Use external secret provider.

Now we can choose our model. This affects both the price and the quality of the responses. Gemini 3.1 Pro is currently the most powerful of Google’s AI models.

Terminal menu showing Default mode with a selected Keep current (google/gemini-3.1-pro-preview) and a list of google/gemini variants

You can easily check the gateway port:

Terminal window showing 'Gateway port' and the number 18789 with a cursor.

Now select “LAN (0.0.0.0)” to ensure that communication with Traefik works later:

Gateway bind menu showing LAN 0.0.0.0; other options: Loopback 127.0.0.1, Tailnet (Tailscale IP), Auto, Custom IP.

Communication is to be secured using tokens. We have already had these set up.

Dark terminal menu: Gateway auth, Token (Recommended default (local + remote)), Password; Token selected.

We do not choose Tailscale:

Tailscale exposure: Off (No Tailscale exposure) selected; Serve and Funnel are unselected.

Now let’s select ‘Generate/store plaintext token’:

Terminal menu asking how to provide the gateway token; options: generate/store plaintext token (default) or use SecretRef.

Confirm the preselected token by pressing ENTER.

Here you can now choose whether you want to use a channel/gateway, or whether you simply want to use OpenClaw via the website. We select “Yes” so that we can integrate Telegram.

Dark terminal showing a Channel status list with items like 'Telegram: needs token' and 'Discord: needs token', and a Yes/No prompt.

We’re choosing Telegram because we want to link it to that.

Terminal-style channel selection with radio bullets listing chat apps (Telegram, WhatsApp, Discord, IRC, Google Chat).

It will now take a few minutes before you are prompted to enter your Telegram API credentials:

Dark UI screen with an orange header labeled Telegram bot token, a bordered code block with steps, and green bullet options.

Now let’s select ‘Finished’, as we don’t want to connect any further services:

Terminal menu listing chat channels with bullets (Telegram, WhatsApp, Discord, IRC, etc.) and a 'Finished (Done)' item at bottom.

During pairing, we select ‘no’, as this mode suits us.

Terminal prompt: Configure DM access policies now? (default: pairing) with Yes and No radio options; No selected.

Now let’s select a search provider. We’ll go with Google, as we already have an API key for it:

Dark terminal panel: Search provider with Brave Search, Gemini (Google Search), Grok, Perplexity, Skip for now.

You can now select the various skills you want to install for OpenClaw:

Dark UI shows a Skills status panel: Eligible 3, Missing 41, Unsupported 7, Blocked 0; Configure skills now? Yes (green dot).

We’ll skip this step by clicking ‘Skip for now’.

A dark terminal-style interface showing the header 'Install missing skill dependencies' and a long list of checkbox items.

You can now enter additional API keys. However, we’ll skip this step.

Terminal window with prompts to set API keys for Google Places, Gemini, Notion, OpenAI, and ElevenLabs; all show 'No'.

You can now define hooks. We’ll skip this as well:

Dialog 'Enable hooks?' with a checkbox list: Skip for now, boot-md, bootstrap-extra-files, command-logger, session-memory.

Finally, we’ll install the zsh shell:

Dark terminal with orange text asking to enable zsh shell completion; green bullet and Yes / No options.

OpenClaw is now set up and is running the configuration. This will take several minutes. Please wait until you see the following:

Dark terminal window with multiple lines of colored text and command output.

5. OpenClaw customisations for Traefik

Now we run another script that makes adjustments to OpenClaw for Traefik:

nano /opt/containers/openclaw/setup2.sh 

Content:

#!/bin/bash 
set -e 
 
echo "Reading configuration..." 
 
if ! TOKEN=$(grep "^OPENCLAW_GATEWAY_TOKEN=" .env | cut -d '=' -f 2); then 
    echo "Error: OPENCLAW_GATEWAY_TOKEN not found in .env." 
    exit 1 
fi 
 
if ! DOMAIN=$(grep -oP 'Host\(`\K[^`]+' docker-compose.yml | head -1); then 
    echo "Error: Could not find a domain (host) in docker-compose.yml." 
    exit 1 
fi 
 
echo "Token found: $TOKEN" 
echo "Domain found: $DOMAIN" 
echo "---" 
 
echo "Disabling Device Auth..." 
docker compose run --rm openclaw-cli config set gateway.controlUi.dangerouslyDisableDeviceAuth true 
 
echo "Allowing domain in Control UI..." 
docker compose run --rm openclaw-cli config set gateway.controlUi.allowedOrigins "[\"https://$DOMAIN\"]" --strict-json 
 
echo "---" 
# 5. Restart the container so that the configuration takes effect 
echo "Restarting container..." 
docker compose down 
docker compose up -d 
 
echo "---" 
echo "✅ Setup completed successfully!" 
echo "" 
echo "The dashboard will be available in a few minutes at the following URL:" 
echo "https://$DOMAIN/#token=$TOKEN" 
echo "" 

We will now run this script:

chmod +x /opt/containers/openclaw/setup2.sh 
cd /opt/containers/openclaw/ 
./setup2.sh 

The script will take several minutes to run. Please wait until you see the following:

Terminal output in German showing container status; lines include Created and erfolgreich abgeschlossen with a red block.

6. Launch OpenClaw

Now copy the link displayed and paste it into your browser. Again, it will take several minutes for OpenClaw to finish starting up.

You should then see this message:

Anmelde-Dialog mit Feldern Benutzernamen und Passwort und Buttons Anmelden und Abbrechen.

Enter the username and password from step 1.3.4 here.

You are now on the OpenClaw interface, where you can configure further settings or execute commands.

Web app UI: left sidebar menu, top header OPENLAW, central Chat area, bottom input with red Send button.

7. Connect Telegram to OpenClaw

Now find the Telegram bot you created in step 3.

UI showing a dogado_bot label, a global search results list, and a blue chat entry for dogado-bot with a purple avatar.

When you enter the command "/start", you should see the following:

White dialog box displaying 'OpenClaw: access not configured' and 'Pairing code: T4VAY9AN' with a red outline.

Now copy this pairing code. Then run the following command on your server:

docker compose run --rm openclaw-cli pairing approve telegram PAIRING-CODE 

In my case, that would be:

docker compose run --rm openclaw-cli pairing approve telegram T4VAY9AN 

Once the command has been successfully processed on your server, enter “/status” in Telegram. You should now see the following:

Telegram chat screenshot with a message: 'OpenClaw: access not configured' and a pairing code, plus a version/status block.

8. OpenClaw versions

New Docker images for OpenClaw are currently released every few days, which is why some menus may look different. Users have also reported in forums that on some days an image may contain an error, which may then be fixed in the next image released a few days later.

9. Running OpenClaw commands

You can now do this via Telegram:

Chat with two purple avatars and three message bubbles: 'Erzähle mir einen Witz', 'Was macht ein Clown im Büro?' and 'Faxen! 🤡'

How to run commands via the website:

Chat UI showing a peach-colored bubble 'Erzähle mir einen Witz' and a white bubble containing the joke 'Was ist orange und geht den Berg hinauf? Eine Wanderine! 🍊🏃'

In the settings, you can also see how many requests OpenClaw has already sent and the approximate costs incurred. However, to be on the safe side, you should always check this on the AI provider’s platform as well.

Dashboard UI: left vertical navigation with 'Nutzung' highlighted; main area shows 'Usage Overview' with several data cards.

Full control with your own VPS from easyname

With a VPS from easyname, you have full control over your server – flexible, scalable and operated in an environmentally conscious manner in ISO-certified data centres in Austria. Ideal for your applications, projects and maximum performance.

Close-up of a blue-lit server rack with multiple drive bays and front-panel indicators.