Introduction
You've discovered what OpenClaw is and are convinced? Perfect. In this step-by-step guide, we'll install OpenClaw on a VPS (Virtual Private Server) from scratch. In 30 minutes, you'll have a functional AI agent connected to Telegram, ready to work for you 24/7.
No unnecessary chatter — just concrete steps.
Step 1: Choose Your VPS
Recommended Options
| Provider | Price | Advantages | Disadvantages |
|---|---|---|---|
| Oracle Cloud | Free (Always Free) | €0/month, powerful ARM | Registration can be difficult |
| Hostinger 🎁 | ~€4/month | 20% discount with our code, intuitive interface, French support | Less known than major players |
| Hetzner | ~€4/month | Excellent price/performance ratio, EU datacenters | No free tier |
| OVH | ~€3.50/month | French, good network | Outdated interface |
| Fly.io | ~$5/month | Easy deployment | Usage-based billing |
| Railway | ~$5/month | One-click deploy | Less control |
💡 Recommendation for beginners : Hostinger VPS KVM 1 (1 vCPU, 4 GB RAM, 50 GB SSD) for ~€4/month. With our partner code, you'll get 20% off on an annual package. Clear interface, French support, perfect for beginners. Alternative: Hetzner CX22 for advanced users.
Minimum Required Configuration
- CPU: 1 vCPU (sufficient)
- RAM: 2 GB minimum (4 GB recommended)
- Disk: 20 GB minimum
- OS: Ubuntu 22.04 or 24.04 LTS (recommended)
- Network: Public IPv4
⚠️ Important: OpenClaw itself consumes few resources. The Gateway is a lightweight Node.js process. AI computing power is outsourced to APIs (OpenRouter, Anthropic, etc.).
Step 2: Connect via SSH
Once your VPS is created, connect to it:
ssh [[username]]@[[ip]]
If you've configured an SSH key (recommended):
ssh -i ~/.ssh/my_key [[username]]@[[ip]]
First thing to do — update the system:
apt update && apt upgrade -y
Basic Security (optional but recommended)
# Create a non-root user
adduser openclaw
usermod -aG sudo openclaw
# Configure the firewall
ufw allow 22/tcp # SSH
ufw allow 443/tcp # HTTPS (if you expose the web interface)
ufw enable
💡 Tip: For a complete security guide, check out our article Securing OpenClaw.
Step 3: Install Node.js 22+
OpenClaw requires Node.js version 22 or higher. Here's how to install it properly:
Recommended Method (NodeSource)
# Install Node.js 22 via NodeSource
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
apt install -y nodejs
Verify the installation:
node --version # Should display v22.x.x or higher
npm --version # Should display 10.x.x or higher
Alternative Method (nvm)
If you prefer managing multiple Node versions:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
nvm install 22
nvm use 22
⚠️ Warning: If you use nvm, ensure that the systemd service (which we'll configure later) points to the correct Node binary.
Step 4: Install OpenClaw
Method 1: Installation Script (recommended)
The simplest method — the script handles everything automatically:
curl -fsSL https://openclaw.ai/install.sh | bash
This script will:
1. Check that Node.js 22+ is installed (and install it if not)
2. Install OpenClaw globally via npm
3. Launch the onboarding assistant
Method 2: Manual Installation via npm
If you prefer controlling each step:
npm install -g openclaw@latest
Then launch the onboarding:
openclaw onboard --install-daemon
💡 In case of error with sharp: If you see compilation errors related to sharp, use:
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
Verify that everything is installed:
openclaw --version
Another useful command for diagnostics:
openclaw doctor
The openclaw doctor command checks your installation and reports any issues. It's your best friend for diagnostics.
Step 5: Initial Configuration
Launch Interactive Setup
openclaw setup
This command will:
- Create the configuration file ~/.openclaw/openclaw.json
- Initialize the workspace ~/.openclaw/workspace
- Create base files (SOUL.md, AGENTS.md, USER.md, etc.)
Manual Configuration
If you prefer editing directly, create the configuration file:
mkdir -p ~/.openclaw
nano ~/.openclaw/openclaw.json
Here's a minimal functional configuration:
{
// Agent workspace
agents: {
defaults: {
workspace: "~/.openclaw/workspace"
}
}
}
Step 6: Configure AI Model (OpenRouter)
OpenClaw needs a language model to function. The most flexible solution is OpenRouter, which provides access to dozens of models (Claude, GPT-4, Gemini, Llama…) via a single API.
Create an OpenRouter Account
- Go to openrouter.ai
- Create an account
- Add credits ( $5 is enough to start)
- Generate an API key in Keys
Configure OpenRouter in OpenClaw
Add the key to your configuration:
openclaw config set models.providers.openrouter.apiKey "sk-or-v1-YOUR_KEY_HERE"
Or edit directly ~/.openclaw/openclaw.json:
{
agents: {
defaults: {
workspace: "~/.openclaw/workspace",
model: "anthropic/claude-haiku-4-5" // Default model (fast and economical)
}
},
models: {
providers: {
openrouter: {
apiKey: "sk-or-v1-YOUR_KEY_HERE"
}
}
}
}
💡 Model Choice:
- anthropic/claude-haiku-4-5: Fast, economical (~$0.25/M tokens). Ideal for common tasks.
- anthropic/claude-sonnet-4: More powerful, good quality/price ratio.
- anthropic/claude-opus-4: Most capable, for complex tasks. More expensive.
You can change models on the fly with the /model command in the chat.
Step 7: Connect Telegram
Telegram is the easiest channel to configure with OpenClaw.
Create a Telegram Bot
- Open Telegram and search for @BotFather
- Send
/newbot - Choose a name (e.g., "My AI Agent")
- Choose a username (e.g.,
my_ai_agent_bot) - BotFather gives you a token — copy it carefully
Configure the Bot in OpenClaw
openclaw config set channels.telegram.token "YOUR_TELEGRAM_TOKEN"
To restrict access to your bot (strongly recommended):
openclaw config set channels.telegram.allowFrom '["YOUR_TELEGRAM_ID"]'
💡 Find Your Telegram ID: Send a message to @userinfobot on Telegram, it will give you your numeric ID.
Or edit the configuration directly:
{
agents: {
defaults: {
workspace: "~/.openclaw/workspace",
model: "anthropic/claude-haiku-4-5"
}
},
models: {
providers: {
openrouter: {
apiKey: "sk-or-v1-YOUR_KEY_HERE"
}
}
},
channels: {
telegram: {
token: "YOUR_TELEGRAM_TOKEN",
allowFrom: ["YOUR_TELEGRAM_ID"]
}
}
}
⚠️ Security: Without allowFrom, anyone can talk to your bot and potentially execute commands on your server. Always configure this restriction.
Step 8: First Test
Start the Gateway:
openclaw gateway start
Verify that it's running:
openclaw gateway status
To see the overall status:
openclaw health
Now, open Telegram and send a message to your bot. If everything is configured correctly, it should respond!
Quick Test
Send these messages to verify that everything works:
"Hello, who are you?"→ It should introduce itself"What's the time?"→ It should give the server time"Create a file test.txt with 'Hello World'"→ It should create the file"Read the file test.txt"→ It should display the content
If it works, congratulations 🎉 — your AI agent is operational!
Step 9: systemd Service (Permanent Operation)
To make OpenClaw run permanently and restart automatically:
Automatic Service Installation
openclaw service install
This command creates and enables a systemd service for you.
Verification
To check the service status:
systemctl status openclaw
To see real-time logs via journalctl:
journalctl -u openclaw -f
Alternative via OpenClaw directly:
openclaw logs -f
Useful Commands
To restart the service:
openclaw gateway restart
To stop the service:
openclaw gateway stop
To start the service:
openclaw gateway start
The service will automatically restart in case of a crash and on server reboot.
Step 10: Diagnostics and Troubleshooting
The Magic Command: openclaw doctor
openclaw doctor
This command checks everything:
- Node.js version
- Valid configuration
- Channel connectivity
- Workspace status
- Known issues
If issues are detected:
openclaw doctor --fix
Common Issues
Bot Doesn't Respond on Telegram
- Check that the Gateway is running:
openclaw gateway status - Check logs:
openclaw logs | tail -50 - Check Telegram token: is it correct in the config?
- Check
allowFrom: is your ID in it?
"Model not found" Error
- Check your OpenRouter key:
openclaw config get models - Check that you have credits on OpenRouter
- Try another model:
/model anthropic/claude-haiku-4-5
Gateway Doesn't Start
To see detailed errors:
openclaw logs --level error
Check configuration:
openclaw doctor
Reset if necessary:
openclaw doctor --fix
openclaw Command Not Found After Installation
If after installation openclaw is not found in a new terminal, check where npm installs global binaries:
npm config get prefix
Add to PATH if necessary:
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Useful Logs
To see complete logs:
openclaw logs
To see real-time logs:
openclaw logs -f
To filter by error level:
openclaw logs --level error
To see warnings:
openclaw logs --level warn
Summary of Commands
Here's a recap of all the commands used:
Installation
Via installation script:
curl -fsSL https://openclaw.ai/install.sh | bash
Alternative via npm:
npm install -g openclaw@latest
Configuration
To launch interactive setup:
openclaw setup
For onboarding with daemon:
openclaw onboard --install-daemon
To diagnose installation:
openclaw doctor
Gateway Management
Start Gateway:
openclaw gateway start
Stop Gateway:
openclaw gateway stop
Restart Gateway:
openclaw gateway restart
Check status:
openclaw gateway status
systemd Service
Install service:
openclaw service install
Check service status:
systemctl status openclaw
Diagnostics
Diagnose installation:
openclaw doctor
Repair automatically:
openclaw doctor --fix
Check overall health:
openclaw health
See real-time logs:
openclaw logs -f