Prerequisites
- Ubuntu 22.04+ (or any Debian-based distro)
- Node.js 20+ installed
- A supported LLM API key (OpenAI, Anthropic, etc.)
Step 1: Install Node.js
If you don't have Node.js 20+:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejsVerify:
node --version # Should be v20+ or v22+Step 2: Install OpenClaw
npm install -g openclawMaster this topic with hands-on labs
Go beyond reading — build real projects in sandboxed environments with expert video guidance.
Browse Courses →Step 3: Initialize Your Agent
mkdir ~/my-agent && cd ~/my-agent
openclaw initThis creates the workspace structure:
- SOUL.md — agent personality
- USER.md — your profile
- AGENTS.md — operating rules
- IDENTITY.md — agent identity
Step 4: Configure Your LLM
Set your API key:
export OPENAI_API_KEY="sk-..."
# or
export ANTHROPIC_API_KEY="sk-ant-..."Add to ~/.bashrc for persistence.
Step 5: Start the Gateway
openclaw gateway startYour agent is now running. Connect it to messaging platforms or use the web interface.
Step 6: Connect Messaging (Optional)
Discord
openclaw config set discord.token YOUR_BOT_TOKENTelegram
openclaw config set telegram.token YOUR_BOT_TOKENGet weekly IT automation tips
Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.
Subscribe Free →Running as a System Service
Create a systemd service for automatic startup:
sudo tee /etc/systemd/system/openclaw.service > /dev/null <<EOF
[Unit]
Description=OpenClaw AI Agent
After=network.target
[Service]
Type=simple
User=$USER
WorkingDirectory=$HOME/my-agent
ExecStart=$(which openclaw) gateway start
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now openclawVerify It Works
openclaw statusYou should see your agent running with connected channels listed.
Next Steps
- Customize
SOUL.mdwith your agent's personality - Install skills from ClawhHub
- Set up memory and heartbeats
---
Ready to go deeper? Check out our hands-on course: OpenClaw Agent — practical exercises you can follow along on your own machine.
Related guide
Related reading: OpenClaw-driven CVE remediation with Ansible covers this in real-world detail.
Ready to learn by doing?
Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.
Related Articles
OpenClaw Volume Permissions Fix
Fix OpenClaw Docker volume permission errors. Resolve EACCES issues for named volumes and bind mounts with troubleshooting steps.
Troubleshoot OpenClaw Gateway Errors
Fix OpenClaw gateway errors: 401 unauthorized, connection refused, origin not allowed, and WebSocket failures with resolution guides.
OpenClaw Reverse Proxy with Caddy
Set up HTTPS for OpenClaw using Caddy reverse proxy. Automatic TLS certificates, WebSocket support, and production config.
Internal Developer Platform Guide
Build an internal developer platform that developers actually use. Learn the five layers of an IDP, common mistakes, build vs buy decisions.
Istio Service Mesh Beginner Guide
Istio adds mTLS, traffic management, and observability to your Kubernetes services without code changes. Learn the core concepts, installation, and practical.
K3s Lightweight Kubernetes Setup
K3s is a lightweight Kubernetes distribution that runs on edge devices, Raspberry Pis, and VMs with a single binary. Learn how to install K3s, add agents.
Explore topics
Browse more articles on the topics covered here.