OpenClaw is an AI agent that runs 24/7 on your own server. It responds in Telegram, performs tasks autonomously, and never sends your data anywhere. In this article, I'll walk through the entire installation process step by step — from renting a VPS to your agent's first message.
Step 1. Rent a VPS and Connect for the First Time
I recommend Hetzner Cloud — the CX22 plan (~$4.49/mo, 2 vCPU / 4 GB RAM / 40 GB NVMe). Together with the API key, basic OpenClaw usage comes to about $20-30/mo. Alternatives: DigitalOcean, Vultr, Contabo.
After creating the server, connect via SSH:
ssh root@YOUR_SERVER_IP
First thing we do — update the system:
apt update && apt upgrade -y
Step 2. Basic Server Security
Before installing OpenClaw, let's set up a firewall and brute-force protection. This is critical — an exposed server will get attacked within minutes.
UFW — Firewall
apt install ufw -y
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
fail2ban — Brute-Force Protection
apt install fail2ban -y
systemctl enable fail2ban
systemctl start fail2ban
Step 3. Install Node.js 22+
OpenClaw requires Node.js version 22 or higher. Install it via the official NodeSource script:
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install nodejs -y
node --version # should show v22.x.x
Step 4. Install OpenClaw
Clone the repository and install dependencies:
cd /opt
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm install
Copy the config file and fill in your keys:
cp .env.example .env
nano .env
In the .env file, fill in:
ANTHROPIC_API_KEY=sk-ant-...
TELEGRAM_BOT_TOKEN=...
AGENT_NAME=MyAgent
Step 5. Run via systemd
To make the agent start automatically after a server reboot, register it as a system service:
nano /etc/systemd/system/openclaw.service
Paste the configuration:
[Unit]
Description=OpenClaw AI Agent
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/openclaw
ExecStart=/usr/bin/node index.js
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Enable and start:
systemctl daemon-reload
systemctl enable openclaw
systemctl start openclaw
systemctl status openclaw
Step 6. Connect Telegram
Create a bot via @BotFather in Telegram. Get the token and paste it into .env. After restarting, the agent will start responding in Telegram.
systemctl restart openclaw
Send your bot /start — and the agent will respond. Congratulations, OpenClaw is up and running!
Step 7. Configure Personality (Optional)
To make the agent "know" who it is and how to respond, create configuration files:
- AGENTS.md — general behavior and agent rules
- SOUL.md — character, tone, personality
- USER.md — information about the owner (you)
More on personality configuration in a separate article.
journalctl -u openclaw -f
Want me to do this for you?
I'll install and configure OpenClaw on your VPS, turnkey — from choosing a server to a running agent in Telegram.
Message Nick on Telegram