Nanobot (Lightweight Openclaw) Setup on VPS
4 min read819 words

Nanobot (Lightweight Openclaw) Setup on VPS

Guide
Technology
Productivity
AI

This is a comprehensive guide to setting up Nanobot securely on a Linux VPS with Whatsapp. We’ll use a dedicated unprivileged user,

uv
for package management, and Systemd for process supervision.

Prerequisites

  • A VPS or home server.
  • API Keys ready (e.g. OpenAI, Anthropic, or OpenRouter).

1. User Creation

We will create a specific user

nanobot
to reduce the attack surface of the agent

# 1. Create the user with a home directory sudo useradd -m -s /bin/bash nanobot # 2. Lock the password (prevents direct SSH login) sudo passwd -l nanobot

2. Environment Setup

We need to install

uv
(for Nanobot) and optionally Node (for Whatsapp).

Install Node.js with nvm

# Download and install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash # in lieu of restarting the shell \. "$HOME/.nvm/nvm.sh" # Download and install Node.js: nvm install 24 # Verify the Node.js version: node -v # Should print "v24.13.1". # Verify npm version: npm -v # Should print "11.8.0".

Install uv

# Switch to nanobot user sudo -u nanobot -i # Install uv curl -LsSf https://astral.sh/uv/install.sh | sh

3. Install & Configure Nanobot

Install Nanobot via uv

This installs nanobot into an isolated virtual environment automatically.

uv tool install nanobot-ai

Run the Onboarding Wizard This creates the necessary folder structure

~/.nanobot
and generates the
AGENTS.md
,
MEMORY.md
, and
config.json
files.

nanobot onboard

Configure API Keys You need to edit the config file to add your LLM provider keys.

vim ~/.nanobot/config.json
  • Find the
    "providers"
    section.
  • Add your key (e.g., for OpenRouter or Anthropic).

You can now start using Nanobot with

nanobot agent
to start a temporary terminal session. For long time persistence a gateway service with a channel setup is recommended which this guide will continue with.

4. Whatsapp

Whatsapp is one of the options available to chat with the agent. There are other alternatives such as Discord or Telegram that have an even easier setup. Refer to https://github.com/HKUDS/nanobot for official documentation.

The WhatsApp bridge is a separate Node.js application that lives inside the

.nanobot
folder. We must initialize it separately and generate a connection.

As

nanobot
user run

nanobot channels login

Go through the setup and link your Whatsapp account by scanning the QR code with the desired account. The setup is finished after getting

✅ Connected To Whatsapp
.

Enable Whatsapp

Open

config.json

vim ~/.nanobot/config.json

In the channels section make the following changes to the Whatsapp section:

  • Set attribute
    enabled
    to
    true
  • Add your Whatsapp number in the
    "allowFrom"
    list (whitelisting)
... "channels": { "whatsapp": { "enabled": true, "bridgeUrl": "ws://localhost:3001", "allowFrom": ["12345678"] }, ...

5. Persistance and Run Service via Systemd

Now we exit the

nanobot
user and return to
root/admin
to set up the background services. Type
exit
to return to your admin user. We need two services: one for the WhatsApp bridge, and one for the main Agent.

Bridge Service

Create the file:

/etc/systemd/system/nanobot-bridge.service

[Unit] Description=Nanobot WhatsApp Bridge After=network.target [Service] Type=simple User=nanobot Group=nanobot WorkingDirectory=/home/nanobot Environment="HOME=/home/nanobot" ExecStart=/home/nanobot/.local/bin/nanobot channels login Restart=always RestartSec=5 [Install] WantedBy=multi-user.target

Gateway Service

Create the file:

/etc/systemd/system/nanobot.service

[Unit] Description=Nanobot Gateway After=network.target nanobot-bridge.service # Ensure bridge starts if we start the agent Wants=nanobot-bridge.service [Service] Type=simple User=nanobot Group=nanobot WorkingDirectory=/home/nanobot Environment="HOME=/home/nanobot" # Add uv's bin directory to PATH so it finds 'nanobot' Environment="PATH=/home/nanobot/.local/bin:/usr/local/bin:/usr/bin:/bin" # Start the gateway ExecStart=/home/nanobot/.local/bin/nanobot gateway Restart=always RestartSec=10 [Install] WantedBy=multi-user.target

Enable and Start

sudo systemctl daemon-reload sudo systemctl enable nanobot-bridge sudo systemctl enable nanobot # Starting the main service will auto-start the bridge due to 'Wants=' sudo systemctl start nanobot

6. Hello World

If everything is setup correctly you’ll now be able to chat with your own personal Nanobot on the Whatsapp number used. Nanobot will store relevant information in the

.nanobot/workspace
folder which you can also edit manually.

Bonus: Maintenance

For easier maintenance here’s a

Makefile
(create with
vim Makefile
) with the relevant commands (run
sudo apt install make
if not installed).

Running

make nanobot-update
updates the Nanobot package and restarts the service in a single command.

.PHONY: nanobot-update nanobot-logs nanobot-restart nanobot-update: sudo systemctl stop nanobot sudo -u nanobot -i uv tool upgrade nanobot-ai sudo systemctl start nanobot sudo systemctl status nanobot --no-pager nanobot-logs: sudo journalctl -u nanobot -u nanobot-channel -f nanobot-restart: sudo systemctl restart nanobot nanobot-channel
Nanobot (Lightweight Openclaw) Setup on VPS