Set up your first always-on AI assistant on a VPS

A hand-held setup guide for running OpenClaw on an Ubuntu server and connecting it to Telegram.

Who this guide is for

This is for people who want a private, always-on AI assistant but feel a bit daunted by servers, SSH, API keys, and command-line setup.

Not for sensitive production work yet. This first setup is a starter install. Harden it properly before using it for confidential client data or anything business-critical.

What size VPS do you need?

In many setups, the VPS costs more than the model usage. A cheap model can cost pennies or a few dollars a month for light personal use.

Need a VPS?

If you are using Hostinger, you can use this referral link for a 20% discount:

Get 20% off Hostinger

Referral note: you get a discount, and I may receive a discount or account credit too. Let's save money together.

Choose VPS hosting, not normal website hosting. You want a Linux/Ubuntu VPS, usually listed as VPS Hosting or KVM VPS. Do not choose Web hosting, WordPress hosting, WooCommerce hosting, Node.js web app hosting, or Agency hosting for this setup.

Before you start

Do not paste API keys into public chats. Treat model API keys and Telegram bot tokens like passwords. If you expose one, revoke it and create a new key.

1. Connect to your VPS

Open Terminal on Mac/Linux, or PowerShell on Windows. Replace YOUR_SERVER_IP with your VPS IP address.

ssh root@YOUR_SERVER_IP

What success looks like: you should see a server prompt, usually something like:

root@your-server:~#

If you see Permission denied, check that you used the right IP address, username, password, or SSH key.

2. Update Ubuntu and enable the firewall

This refreshes Ubuntu's package list, installs security updates, allows SSH, and turns on the firewall.

apt update
apt -y upgrade
ufw allow OpenSSH
ufw --force enable

What success looks like: the update finishes without errors and ufw says the firewall is active.

Some VPS dashboards may show system restart required after updates. That is normal. Reboot later when convenient, unless the server is already running something important.

3. Install Node.js and OpenClaw

OpenClaw runs on Node.js. This installs Node.js 22 and then installs OpenClaw globally.

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
npm i -g openclaw

What success looks like: this command should print a version number:

openclaw --version

4. Run the OpenClaw setup wizard

The wizard asks for your model provider, API key, and basic assistant settings.

openclaw onboard

If you are unsure, start with the provider and model you already have credits for. OpenAI is the most familiar option. DeepSeek and other OpenAI-compatible providers can be much cheaper for testing.

Paste API keys only into the setup prompt or a private server config file. Do not send them to another person or bot.

5. Start OpenClaw

openclaw gateway start

Check whether it is running:

openclaw gateway status

What success looks like: the status command should show the gateway is running.

6. Connect Telegram

Create a Telegram bot with @BotFather. Copy the token, then run these commands on the VPS.

openclaw config set channels.telegram.botToken "YOUR_BOT_TOKEN"
openclaw config set channels.telegram.enabled true
openclaw gateway restart

What success looks like: message your Telegram bot. It should reply through OpenClaw.

One Telegram bot token should have one active service using it. If two services use the same token, replies may break or become unpredictable.

7. Make sure it survives a reboot

If you restart the VPS, check whether OpenClaw comes back automatically.

reboot

Wait a minute, reconnect with SSH, then run:

openclaw gateway status

If it is not running, start it again:

openclaw gateway start

Common problems

SSH says Permission denied

Check the IP address, username, password, or SSH key. Many VPS providers also have a browser console you can use as a fallback.

openclaw: command not found

The install did not finish, or npm's global bin folder is not on your path. Try reconnecting to SSH first, then run openclaw --version again.

The Telegram bot does not reply

Check that the token is correct, Telegram is enabled, and the gateway was restarted after setting the token.

The model gives an error

Common causes are no API credits, a revoked API key, the wrong model name, or a provider endpoint that does not match your key.

The server says restart required

That usually means Ubuntu installed updates that need a reboot. Reboot when convenient, then check OpenClaw status again.

How to clean up or remove it

If you are experimenting, it helps to know how to undo things. Before deleting anything, back up any config you want to keep.

openclaw gateway stop
npm rm -g openclaw

If you created extra services, bot files, or custom systemd units, remove those separately. Do not delete files unless you know what they are.

Done

Your assistant should now be running on your VPS.

Next useful steps: test Telegram, check costs after a day or two, and keep your API keys private.