# How to Install OpenClaw on a VPS and Run Your Own 24/7 AI Agent on Telegram

Want your own AI assistant that's online all day, that you can message from your phone like a friend? That's exactly what this setup gives you.

In this guide I put **OpenClaw** — a self-hosted AI agent — on a cheap cloud server (a DigitalOcean VPS), and connect it to a **Telegram bot**. Once it's running, you just text your bot and it replies, runs tasks, and works for you around the clock. No laptop needed.

Here's the whole thing in plain words.

---

## What is OpenClaw?

OpenClaw is an AI agent you host yourself. Think of it like ChatGPT, but:

- It runs on **your own server**, not someone else's.
- It stays **online 24/7**, even when your laptop is off.
- You talk to it through **Telegram**, so it's always in your pocket.
- It can use tools, run tasks, and remember what you're doing.

You bring your own AI "brain" (an API key from **Claude** or **OpenAI**), and OpenClaw handles the rest.

---

## Why put it on a VPS?

You *can* run OpenClaw on your laptop. But the moment you close the lid, your agent goes to sleep.

A **VPS** (a small always-on cloud computer) fixes that. It runs day and night, so your agent is always ready. A basic DigitalOcean server costs about **$6/month** — that's all you need to start.

**Why Telegram?** Because it's the easiest way to reach a server-hosted agent. You don't need a website, a domain, or any port setup. Telegram talks to your bot directly, and you talk to it from any phone.

---

## What you'll do (the big picture)

The whole thing takes about **20 minutes**. Here are the six steps:

1. **Create a server** on DigitalOcean (Ubuntu).
2. **Log in and install** Node.js and OpenClaw.
3. **Create a Telegram bot** with @BotFather and copy its token.
4. **Run the setup wizard** — add your AI key, pick Telegram, paste the token.
5. **Approve the pairing** and test it by messaging your bot.
6. **Turn on 24/7 mode** so it keeps running after you log out.

That's it. The full commands are in [`SETUP-GUIDE.md`](SETUP-GUIDE.md), and a quick command cheat-sheet is in [`COMMANDS.md`](COMMANDS.md).

---

## What you'll need before you start

- A **DigitalOcean account** (or any VPS provider — Hetzner, Fluence, etc.)
- An **LLM API key** — from [Anthropic (Claude)](https://console.anthropic.com) or [OpenAI](https://platform.openai.com). Claude is the most popular in the OpenClaw community.
- A **Telegram account** on your phone.
- About **$6/month** for the smallest server, and **20 minutes**.

---

## The setup, step by step

### 1. Create the server

In DigitalOcean, create a new **Droplet**:

- **Image:** Ubuntu 24.04 LTS
- **Size:** Basic — 1 GB RAM is enough to start (2 GB is smoother)
- Add your SSH key (or a password), then create it and note the **IP address**.

> Tip: DigitalOcean even has a **1-Click OpenClaw** image in its Marketplace that skips most of the install — but doing it by hand once teaches you how it works.

### 2. Log in and install

Connect to your server and install everything:

```bash
ssh root@YOUR_SERVER_IP

apt update && apt upgrade -y

# Install Node.js (OpenClaw needs Node 22 or newer)
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

# Install OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
```

Then create a normal (non-root) user to run it safely:

```bash
adduser openclaw
usermod -aG sudo openclaw
loginctl enable-linger openclaw
su - openclaw
openclaw --version
```

### 3. Create your Telegram bot

On your phone, open Telegram and message **[@BotFather](https://t.me/BotFather)**:

1. Send `/newbot`
2. Give it a name and a username (must end in `bot`)
3. BotFather sends you a **token** that looks like `123456789:ABCdef...` — copy it.

### 4. Run the setup wizard

Back on the server, start onboarding:

```bash
openclaw onboard --install-daemon
```

The wizard will ask you a few things:

- Pick **QuickStart** mode.
- Paste your **LLM API key** (Claude or OpenAI) and pick a model.
- Choose **Telegram** as your channel.
- Paste the **bot token** from BotFather.
- Skip the optional extras (web search, skills) for now.

The `--install-daemon` part sets it up to run automatically in the background.

### 5. Approve and test

Approve the Telegram connection, then message your bot:

```bash
openclaw pairing approve telegram --notify
```

Now open your bot in Telegram, send `/start`, then say `hi`. If it replies — **you're done.** You have a live AI agent.

### 6. Keep it running 24/7

Make sure it survives reboots and logouts:

```bash
sudo loginctl enable-linger $USER
openclaw status
```

If your server has only 1 GB of RAM, add a little swap space so it never runs out of memory (see [`SETUP-GUIDE.md`](SETUP-GUIDE.md)).

---

## Handy checks

- `openclaw status` — is it running?
- `openclaw gateway status` — is the gateway healthy?
- `openclaw logs --follow` — watch live logs if something's off

More fixes are in [`TROUBLESHOOTING.md`](TROUBLESHOOTING.md).

---

## That's it

You now have your own AI agent, running 24/7 on a $6 server, that you can message from Telegram anytime. Bring your own AI key, and it's yours to shape.

Grab the guides below and follow along. If you'd rather have this set up for you — or want a custom agent built for your business — that's exactly what we do.
