
Nanobot (Lightweight Openclaw) Setup on VPS
This is a comprehensive guide to setting up Nanobot securely on a Linux VPS with Whatsapp. We’ll use a dedicated unprivileged user,
Prerequisites
- A VPS or home server.
- API Keys ready (e.g. OpenAI, Anthropic, or OpenRouter).
1. User Creation
We will create a specific user
# 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
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 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
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
As
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
Enable Whatsapp
Open
vim ~/.nanobot/config.json
In the channels section make the following changes to the Whatsapp section:
- Set attribute “enabled”totrue
- 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
Bridge Service
Create the file:
[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:
[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
Bonus: Maintenance
For easier maintenance here’s a
Running
.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