Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Setting Up OpenClaw on a Linux Server – Build Your Personal AI Assistant!

Discover how to set up and configure OpenClaw for self-hosting to build a personal and powerful open-source AI assistant

30 November 202612 min read162 Views0 helpful

Introduction

OpenClaw is a self-hosted AI assistant that handles tasks for you: it answers questions, summarizes content, controls its own browser, and talks with you through the web dashboard or messengers like Telegram, Discord, Slack, and WhatsApp. Its responses come from an AI model of your choice, such as one from Anthropic, OpenAI, OpenRouter, or Google Gemini.

In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App, which gets OpenClaw running over HTTPS with its own browser for automation in just a few clicks, and manual installation with the official installer from the console. After that, you’ll connect messengers and extend OpenClaw with skills and hooks.

When It Makes Sense to Run OpenClaw on a Server

You can also run OpenClaw on your own PC. A VPS or Dedicated Server is a good fit if:

  • you want your assistant to always be available, for example, through Telegram or Discord, even when your PC is turned off.
  • you want an assistant for multiple channels: Instead of separate bots for each messenger, one OpenClaw instance uses the same configuration and context, no matter where you message it from.
  • you want recurring tasks to run automatically, such as summarizing content, organizing information, or generating structured responses.
  • you want OpenClaw to interact with websites that don’t have an API: Browser automation then runs in its own browser on the server, not on your work computer with your private sessions.

A server is less suitable if you want OpenClaw to control programs and files on your own PC or run local AI models on a graphics card. A VPS has no display or GPU; AI responses come from your provider’s API service.

The Easy Way: OpenClaw as a One-Click App

The fastest way to get your own OpenClaw instance is through the One-Click Apps on your VPS or Dedicated Server. The app is directly accessible over HTTPS using a domain, is also protected by a login, and comes with its own Chromium browser for browser automation. All you need to do is enter your AI provider’s API key.

Requirements

  • A Linux VPS or Dedicated Server (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
  • An API key from an AI provider, such as Anthropic, OpenAI, OpenRouter, or Google Gemini. OpenClaw won’t start without a key.
  • Enough memory: The app starts its own browser container alongside OpenClaw. Refer to the table under “Manual Installation” > “Requirements.”

Install

  1. Open your server in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search for OpenClaw in the app catalog and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave the option enabled or enter your own name: You’ll access OpenClaw over HTTPS through the domain, and the connection to the Gateway will also use it.
  4. Open App configuration and enter your API key in the appropriate field, for example, ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, or GEMINI_API_KEY. The form marks all fields as optional, but without at least one key, OpenClaw will get stuck in a restart loop. Leave any fields you don’t need blank.
  5. Click Queue installation. The first time you install it, your server will download around 5 GB of images, which can take 10 to 15 minutes.
Info: Error message during the initial download

If the download takes longer than about 10 minutes, the app card may show “The app failed to start,” even though the download is still running in the background. Wait a few minutes, then open the Access link. The message may remain on the card even after OpenClaw is running.

Tip: Forgot your key?

If you installed the app without an API key, the app card will show that the app isn’t starting correctly. Enter the key in the app settings (gear icon) under App environment, then click Save. The app will restart afterward.

First Login

OpenClaw access is protected twice: first by a browser login, then by the Gateway token. You can find both in the app settings (gear icon) under App environment > Automatically generated values:

ValuePurpose
SERVICE_USER_OPENCLAWUsername for the browser login
SERVICE_PASSWORD_OPENCLAWPassword for the browser login
SERVICE_PASSWORD_64_GATEWAYTOKENGateway token
  1. Open the app’s Access link and sign in with your username and password.
  2. OpenClaw displays “This Gateway expects its token.” Enter the token in the Gateway secret field and click Connect.
  3. The first time, OpenClaw displays “Approve this browser”: Each new browser must be approved on the server once. The page shows a command such as openclaw devices approve <ID>. Connect to your server via SSH and run it in the OpenClaw container, using the ID shown on your page:
bash
docker exec $(docker ps -q --filter name=openclaw-) openclaw devices approve <ID>

The page will connect automatically afterward, or you can click Check now.

You’ll then land in the chat and can give OpenClaw its first tasks. Unless you specify a different model, OpenClaw uses a default model from your provider. To choose another one, use the OPENCLAW_PRIMARY_MODEL field under App environment.

Warning: Keep your token and password secret

Your Gateway token and login details provide full control over your OpenClaw instance, including its stored API keys. Don’t share them or show them in screenshots.

Connect Messengers

OpenClaw can also talk with you through Telegram, Discord, Slack, or WhatsApp. Enter your bot tokens in the app settings (gear icon) under App environment, for example, in TELEGRAM_BOT_TOKEN or DISCORD_BOT_TOKEN. The app restarts after you save. For instructions on creating a Telegram bot and setting up channels, see “Set Up Messengers, Skills, and Hooks” below.

Warning: Leave unused fields blank

Leave fields for messengers you don’t use blank. A placeholder value like unset counts as a real token and will cause OpenClaw to fail at startup.

Updates and backups

Update OpenClaw in the app settings (gear icon) under App update. Click Check for updates and install a new version using Apply update. Your settings, sessions, and workspace are stored in a separate volume and are retained during the update. You can also back up your server using the backups in the ZapX dashboard.

Manual Installation

The rest of this guide covers manual installation of OpenClaw using the official installer from the console. This is useful, for example, if you want to run OpenClaw directly on the system rather than in Docker, or if you want to choose every step yourself.

Requirements

  • A Linux VPS or Dedicated Server running Debian or Ubuntu, with SSH access. See First SSH Access.
  • An API key from an AI provider, such as OpenAI or Anthropic.

Resource usage can quickly increase depending on how you use OpenClaw. Simple setups, such as using only the web interface with minimal automation, run well on smaller VPS plans. Multiple channels, many enabled skills, or browser automation require significantly more performance; for these setups, we recommend a Dedicated Server.

HardwareMinimumRecommended
CPU1 vCPU core8 vCPU cores
RAM4 GB16 GB
Storage25 GB50 GB

Prepare the Firewall

By default, OpenClaw binds its Gateway and Control UI only to 127.0.0.1 on port 18789. This means you don’t need to open a port for external access, and you should keep it that way. Use ufw to allow only SSH and, if you later use a reverse proxy, HTTP and HTTPS:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

Don’t open port 18789 in the firewall. You can access the browser interface through an SSH tunnel or HTTPS. Learn more in Managing the Firewall on Linux.

Install with the Official Installer

Connect to your server via SSH and run the official installer:

bash
curl -fsSL https://openclaw.ai/install.sh | bash

The installer detects your operating system and installs missing dependencies such as Node.js using the system package manager, without requiring any input from you. It then downloads and installs OpenClaw and automatically starts onboarding.

When installation is complete, you’ll see a confirmation like this:

Onboarding

Onboarding completes the initial setup and is required before you can use OpenClaw:

  1. Read and accept the security notice shown on screen.
  2. Choose an onboarding mode. QuickStart is the right choice for most users.
  3. Choose your model or authentication provider—in this example, OpenAI—and enter your API key. OpenClaw saves it locally in the configuration.
  4. Choose the default model OpenClaw should use.
  5. Optionally, set up channels (such as Telegram, Discord, or Slack), skills, and hooks now. You can skip these steps and complete them later.
  6. OpenClaw then automatically installs the Gateway Service. Finally, choose Web UI so OpenClaw displays the link to the dashboard.

At the end, OpenClaw offers to install the Shell Completion Script. This is optional, but makes working in the console easier by automatically completing OpenClaw commands.

First Access via SSH Tunnel

Servers are provided without a graphical interface, so OpenClaw runs in headless mode. After onboarding, OpenClaw displays the dashboard access details in the console:

Code
Dashboard link (with token):
http://127.0.0.1:18789/?token=XXXXXXXXXXXXXXXXXXXXXXXX

No GUI detected. Open from your computer:
ssh -N -L 18789:127.0.0.1:18789 root@SERVER_IP

Because the interface is bound only to 127.0.0.1, you’ll need to create an SSH tunnel on your own computer. Replace SERVER_IP with your server’s IP address:

bash
ssh -N -L 18789:127.0.0.1:18789 root@SERVER_IP

As long as this connection remains open, you can access the OpenClaw Control UI in your browser at http://localhost:18789/. If OpenClaw asks you to sign in, open the link with the token shown in the output above.

Tip: Use a graphical interface

If you’d rather use OpenClaw directly on the server with a graphical interface, install a desktop environment such as XFCE and a remote desktop solution such as RDP or VNC. You won’t need an SSH tunnel in that case.

Access via HTTPS Through a Reverse Proxy

For remote access, the official documentation recommends an SSH tunnel or Tailscale Serve. To use your own domain, put a reverse proxy with an SSL certificate in front of it. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). You’ll need a domain or subdomain whose A record points to your server’s IP address (e.g., openclaw.example.com).

The Gateway remains bound to 127.0.0.1; only nginx accepts external requests. The proxy must forward WebSockets and replace the originating IP address rather than append to it. Here’s a server block for nginx:

Code
server {
    listen 80;
    server_name openclaw.example.com;

    location / {
        proxy_pass http://127.0.0.1:18789;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Then obtain the certificate using certbot --nginx -d openclaw.example.com. Certbot adds HTTPS and HTTP redirection to the block.

To make OpenClaw trust the proxy and allow the Control UI to be accessed through your domain, add these two entries to the existing gateway block in the configuration file ~/.openclaw/openclaw.json. Leave the other entries, such as the port and authentication settings, unchanged:

Code
gateway: {
  trustedProxies: ["127.0.0.1"],
  controlUi: {
    allowedOrigins: ["https://openclaw.example.com"],
  },
},

Then restart the Gateway with openclaw gateway restart. If trustedProxies is missing, OpenClaw will reject requests through the proxy with 403 and the message proxy_attribution_required.

Through the proxy, your browser is no longer treated as local: After signing in with the token, it must be approved once. Show pending requests on the server with openclaw devices list and approve your browser with openclaw devices approve <ID>. A request expires after 5 minutes.

Warning: Don’t expose the Gateway directly

Don’t set gateway.bind to a public address. External access must go through the proxy only.

Back Up Your Data

Everything that makes up your installation is in the ~/.openclaw directory: the openclaw.json configuration, your channel credentials in the credentials subfolder, paired devices and sessions in SQLite databases, and your workspace.

Don’t simply copy the databases while they’re running. Instead, use OpenClaw to create a verified backup archive:

bash
openclaw backup create --output ~/Backups/openclaw --verify

To back up only the configuration, use openclaw backup create --only-config --output ~/Backups/openclaw. Download the archives regularly or also use your server backups in the ZapX dashboard.

To restore a backup, openclaw backup restore <Archiv.tar.gz> --target <Ordner> extracts the archive into a new folder. Stop the Gateway with openclaw gateway stop before moving the data into place, then start it again. Installed plugins aren’t included in the archive and must be reinstalled. See the official backup guide for details.

Update OpenClaw

By default, the installer sets up OpenClaw as a global npm package. Update it as follows:

bash
openclaw backup create --output ~/Backups/openclaw --verify
openclaw update
openclaw update status

openclaw update restarts the Gateway after the update and checks it. If the new version doesn’t start, OpenClaw restores the previous version. To install a specific version, use openclaw update --tag <Version>. If OpenClaw reports outdated settings after an update, fix them with openclaw doctor --fix. Check whether your channels are connected again with openclaw channels status --probe.

Set Up Messengers, Skills, and Hooks

After installation, connect messengers, enable skills, and create hooks for recurring workflows. You can find all of these in the dashboard; with a manual installation, they’re also available during onboarding.

Create a Telegram Bot

For Telegram, you’ll need your own bot and its token. Create one directly in Telegram through the official BotFather account:

  1. Open the chat with BotFather and send /newbot.
  2. Enter a display name for your bot, for example, ZAP DOCS EXAMPLE.
  3. Enter a username. It must end in bot, for example, ZAP_DOCS_EXAMPLE_BOT.
  4. BotFather confirms that the bot has been created and displays the HTTP API token. Copy it and keep it somewhere safe.

Enter the token in TELEGRAM_BOT_TOKEN during onboarding, in the dashboard under Channels, or in the One-Click App under App environment. Anyone with the token can control your bot, so never share it publicly.

Configure Channels

Channels connect OpenClaw to messaging platforms. In the dashboard, set up and connect supported channels such as Telegram, Discord, and Slack. Depending on the platform, you’ll need a token or other credentials, as with the Telegram bot above.

By default, OpenClaw only replies to direct messages from unknown senders after approval. If your bot sends a pairing code the first time someone contacts it, approve the code on the server:

bash
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>

The code is valid for one hour. With the One-Click App, run the commands in the OpenClaw container using docker exec, just as you did for browser approval.

Once the channel is connected, OpenClaw can receive and reply to messages on that platform. For example, a Telegram conversation looks like this:

Install Skills

Skills extend OpenClaw with additional features and integrations. OpenClaw includes more than 50 skills, which you can select and enable in the dashboard under Skills. Find more community skills on ClawHub.

Enable Hooks

Hooks let OpenClaw automatically perform actions when specific events occur or when you use certain commands. Use them to automate recurring tasks, save context, or start workflows without manual effort.

Security and Limitations

OpenClaw is a powerful tool: It can send messages, interact with websites, and use your API keys. Keep the following in mind:

  • Treat the Gateway token like a password. Never share it publicly, such as in screenshots, support tickets, or chat histories. Anyone with the token can control your dashboard.
  • Use one instance per trust group. According to the official documentation, a Gateway doesn’t separate users who don’t trust one another. Only share your instance with people you’d also trust with your API keys.
  • Be careful with untrusted content. Websites and messages may contain instructions that could trick OpenClaw into taking unwanted actions. Enable only the skills and channels you really need.
  • Have your settings checked. Run openclaw security audit to check your configuration for unsafe settings, such as a token that’s too short.
  • Keep an eye on API costs. Your provider bills each request to the AI model according to its own terms. Multiple channels, hooks, and automations will generate more requests.

Conclusion

You’ve installed OpenClaw on your VPS or Dedicated Server, secured access, and learned how to set up messengers, skills, and hooks. Find more information on openclaw.ai, in the OpenClaw documentation, and among the community skills on ClawHub.

Prefer to skip the console? Use the easy One-Click App option described above under “The Easy Way: OpenClaw as a One-Click App.” HTTPS, login, and a dedicated browser for automation are already set up.

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

OpenClaw is a self-hosted AI assistant that handles tasks for you, can control its own browser, and is accessible through a web dashboard or messengers like Telegram, Discord, Slack, and WhatsApp. Its responses come from an AI model of your choice, such as one from Anthropic, OpenAI, OpenRouter, or Google Gemini.
The One-Click App is the fastest option: HTTPS through a custom subdomain, an additional login, and a dedicated browser for automation are already set up, and you can install updates in the dashboard. Manual installation with the official installer is a good choice if you want to run OpenClaw directly on the system, manage the entire configuration yourself, or skip HTTPS and access it only through an SSH tunnel.
Yes. OpenClaw needs at least one API key from an AI provider, such as Anthropic, OpenAI, OpenRouter, or Google Gemini. The One-Click App form marks the fields as optional, but OpenClaw will keep restarting without a key. Your AI provider bills model usage according to its own terms.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.