完整安装步骤(AlmaLinux 8.10)
第一步:更新系统并安装基础依赖
# 更新系统
sudo dnf -y update
安装开发工具组(编译依赖)
sudo dnf -y groupinstall "Development Tools"
sudo dnf -y install gcc-c++ make
第二步:安装 Node.js 22(必须 v22.x)
# 添加 NodeSource 仓库并安装 Node.js 22
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo dnf -y install nodejs
# 验证安装(必须显示 v22.x)
node -v
npm -v
⚠️ 注意:OpenClaw 严格要求 Node.js v22.x,v20 及以下会报错
第三步:配置 PATH 环境变量
# 配置 npm 全局路径(重要)
npm config set prefix /usr/local
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
# 验证 npm 全局路径
npm config get prefix
# 应该显示 /usr/local
第四步:安装 Homebrew(某些技能需要)
/bin/bash -c "(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 配置 brew 环境变量
echo >> ~/.bash_profile
echo 'eval "(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
第五步:安装 OpenClaw
# 创建用户专属的 npm 全局目录
mkdir ~/.npm-global
# 配置 npm 使用这个目录
npm config set prefix '~/.npm-global'
# 添加到 PATH
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bash_profile
source ~/.profile
# option1:官方一键安装脚本
curl -fsSL https://openclaw.ai/install.sh | bash
# option2:通过 npm 安装
npm install -g openclaw@latest
# 虽然有个 deprecation 警告,但不影响使用。
# 验证 OpenClaw 安装
openclaw --version
第六步:运行初始化向导
# 启动向导,会引导你配置 LLM 和聊天渠道
openclaw onboard --install-daemon
--install-daemon 会创建 systemd 服务,让 OpenClaw 开机自启、后台运行。
向导会交互式地配置:
– 选择默认 AI 模型提供商
– 设置聊天渠道(微信/WhatsApp/Telegram 等)
– 配置存储路径
第七步:与 Snowflake Cortex 配合的配置
编辑配置文件 ~/.openclaw/openclaw.json:
{
"version": "1",
"models": {
"providers": {
"snowflake-cortex": {
"baseUrl": "https://<你的账户>.snowflakecomputing.com/api/v2/cortex/v1",
"apiKey": "<你的 Snowflake PAT>",
"api": "openai-completions",
"models": [
{
"id": "claude-sonnet-4-5",
"name": "Claude Sonnet 4.5",
"reasoning": false,
"input": ["text"],
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "snowflake-cortex/claude-sonnet-4-5"
}
}
}
}
第八步:
WhatsApp (via the baileys library) requires certain system libraries to handle media and QR generation.
sudo yum install vips vips-devel -y
You need to manually trigger a fresh login to generate a new QR code. Run these command:
- stop the background service:
systemctl --user stop openclaw-gateway
- Delete the WhatsApp session folder entirely
rm -rf ~/.openclaw/whatsapp
- Run the login manually (this will stay in your terminal):
openclaw channels login --channel whatsapp
If you see a QR code in the terminal:
Open WhatsApp on your phone.
Go to Settings > Linked Devices > Link a Device.
Scan the code immediately.
- Once the phone says “Active” and the terminal shows “WhatsApp connected”: Press Ctrl+C to stop the manual process.
-
Restart the background service:
systemctl --user start openclaw-gateway
- Register the Second Account via CLI
The most reliable way to link a second number is through the terminal, as it generates the required session files for the new ID.
Run the following command, replacing work with whatever name you want for the second account:
openclaw channels login --channel whatsapp --account work
Action: A new QR code will appear. Scan it using the second WhatsApp phone.
Result: OpenClaw will save a separate session under that ID (e.g., ~/.openclaw/credentials/whatsapp/work).
You must now tell the gateway to recognize both accounts. Your channels block should be updated to include an accounts object:
"channels": {
"whatsapp": {
"enabled": true,
"selfChatMode": true,
"groupPolicy": "disabled",
"debounceMs": 500,
"mediaMaxMb": 50,
"accounts": {
"default": {
"dmPolicy": "allowlist",
"allowFrom": ["17203188980@s.whatsapp.net"]
},
"work": {
"dmPolicy": "allowlist",
"allowFrom": ["SECOND_NUMBER@s.whatsapp.net"]
}
}
}
}
Note: If you want one number to be the primary one for general routing, you can set defaultAccount: “default”.
Restart the Service
systemctl --user restart openclaw-gateway
第九步:测试
cd /tmp/openclaw
tail -f openclaw-2026-03-22.log
# 停止 gateway
openclaw gateway stop
# 清理可能存在的旧认证缓存
rm -rf ~/.openclaw/agents/main/agent/auth-profiles.json
rm -rf ~/.openclaw/agents/main/agent/config.json
# 重新启动 gateway
openclaw gateway start
# 等待几秒让 gateway 完全启动
sleep 5
# 测试
openclaw tui
🦞 OpenClaw 2026.3.13 (61d171a) — I'll refactor your busywork like it owes me money.
openclaw tui - ws://127.0.0.1:18789 - agent main - session main
gateway disconnected: closed | idle
session agent:main:main
⚠️ Agent failed before reply: No API key found for provider "anthropic". Auth store: /home/snow/.openclaw/agents/main/agent/auth-profiles.json (agentDir:
/home/snow/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir.
Logs: openclaw logs --follow
⚠️ Agent failed before reply: No API key found for provider "anthropic". Auth store: /home/snow/.openclaw/agents/main/agent/auth-profiles.json (agentDir:
/home/snow/.openclaw/agents/main/agent). Configure auth for this agent (openclaw agents add <id>) or copy auth-profiles.json from the main agentDir.
Logs: openclaw logs --follow
how is the weather today?
Let me check the weather for you. First, let me look up your timezone/location context.No location info saved yet. Since your timezone is
America/Toronto, I'll check the weather for Toronto.Here's Toronto right now:
🌦 +4°C (feels like +2°C) — light rain and mist. Wind from the southeast at 10 km/h, 100% humidity, visibility about 5 km. Expect about 2mm of
precipitation.
Classic late-March Toronto — damp and grey. Jacket and umbrella weather for sure.
By the way, I'm working off the assumption you're in Toronto based on your timezone. If you're somewhere else, just let me know and I'll check that
instead!
connected | idle
agent main | session main (openclaw-tui) | snowflake-cortex/claude-opus-4-6 | tokens ?/200k
从输出可以看到:
✅ Gateway 已连接(虽然显示有 anthropic 错误,但实际已经切换到 Snowflake Cortex)
✅ AI 正常回复:它告诉你多伦多的天气(+4°C,小雨)
✅ 模型正确:显示 snowflake-cortex/claude-opus-4-6
✅ 功能正常:AI 能够基于你的时区(America/Toronto)推断位置并查询天气
systemctl --user restart openclaw-gateway
~~systemctl --user status openclaw-gateway~~
By default, systemctl –user services are killed the moment you log out or the server reboots. To ensure the bot starts automatically when the server boots (without you needing to log in), run this command:
sudo loginctl enable-linger snow
Why you need this:
systemctl –user enable: This tells the system to start the service when your user session starts.
loginctl enable-linger: This tells the system to start your user session (and all your services) as soon as the hardware boots, even if no one is logged into the console.
How to verify it’s truly “Permanent”:
Enable lingering: sudo loginctl enable-linger snow
Ensure the service is enabled: systemctl –user enable openclaw-gateway
Reboot the server: sudo reboot
After the reboot, wait 1 minute and try to message your bot on WhatsApp. If it replies, you are all set!
openclaw.json
[snow@devops .openclaw]$ cat openclaw.json
{
"meta": {
"lastTouchedVersion": "2026.3.13",
"lastTouchedAt": "2026-03-22T17:55:56.095Z"
},
"wizard": {
"lastRunAt": "2026-03-22T16:20:35.111Z",
"lastRunVersion": "2026.3.13",
"lastRunCommand": "onboard",
"lastRunMode": "local"
},
"models": {
"providers": {
"snowflake-cortex": {
"baseUrl": "https://<account>.snowflakecomputing.com/api/v2/cortex/v1",
"apiKey": "?///",
"api": "openai-completions",
"models": [
{
"id": "claude-opus-4-6",
"name": "Claude opus 4.6"
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "snowflake-cortex/claude-opus-4-6"
},
"compaction": {
"mode": "safeguard"
}
}
},
"tools": {
"profile": "coding"
},
"commands": {
"native": "auto",
"nativeSkills": "auto",
"restart": true,
"ownerDisplay": "raw"
},
"session": {
"dmScope": "per-channel-peer"
},
"hooks": {
"internal": {
"enabled": true,
"entries": {
"command-logger": {
"enabled": true
},
"session-memory": {
"enabled": true
}
}
}
},
"channels": {
"whatsapp": {
"enabled": true,
"selfChatMode": true,
"groupPolicy": "disabled",
"debounceMs": 500,
"mediaMaxMb": 50,
"accounts": {
"default": {
"dmPolicy": "allowlist",
"allowFrom": ["17203188980@s.whatsapp.net"]
},
"work": {
"dmPolicy": "allowlist",
"allowFrom": ["6476899988@s.whatsapp.net"]
}
}
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowedOrigins": [
"http://localhost:18789",
"http://127.0.0.1:18789",
"http://192.168.8.22:18789"
]
},
"auth": {
"mode": "token",
"token": "xxx"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
},
"nodes": {
"denyCommands": [
"camera.snap",
"camera.clip",
"screen.record",
"contacts.add",
"calendar.add",
"reminders.add",
"sms.send"
]
}
},
"skills": {
"install": {
"nodeManager": "npm"
}
},
"plugins": {
"entries": {
"whatsapp": {
"enabled": true
}
}
}
}
第十步:Linkedin
To set up LinkedIn access via the Composio plugin, follow these steps to install the plugin, configure your API key, and authenticate your account.
- Install the Plugin
Run the following command in your terminal to download and install the Composio integration:
openclaw plugins install @composio/openclaw-plugin
- Configure your Consumer Key
You need a Composio Consumer Key (starts with ck_…) to link your local instance to the service.
Log in to your Composio Dashboard.
https://dashboard.composio.dev/login
Sign-In Options: You can log in using your Google account (which matches your LinkedIn/Gmail setup) or GitHub.
Locate the Key: Once logged in, navigate to the Settings or API Keys section (often found under a “Connect” or “Clients” tab) to find your Consumer Key (it will start with ck_…).
Copy your Consumer Key.
Apply it to your OpenClaw configuration by running:
openclaw config set plugins.entries.composio.config.consumerKey "ck_your_key_here"
# The "plugin id mismatch" warning is a common naming quirk in OpenClaw and won't stop it
# from working as long as the Consumer Key is correctly recognized.
# Since the log says Updated plugins.entries.composio.config.consumerKey, you just need to # clear that "No consumer key" error by restarting.
- Allow Composio Tools
Ensure your agent is authorized to use tools from the Composio namespace:
openclaw config set tools.alsoAllow '["composio"]'
- Restart the Gateway
Apply the new settings by restarting your background service:
systemctl --user restart openclaw-gateway
- Authenticate LinkedIn
Now, simply talk to your bot via WhatsApp or the Web UI to trigger the login:
Ask the bot: “Connect my LinkedIn account.”
The bot will respond with an authentication link.
Open the link, click “Continue with Google” (since you use Gmail for login), and authorize the connection.
Verify Setup
Once authenticated, you can test it by asking the bot:
“What was my last LinkedIn post?”
“Search LinkedIn for people with the title ‘DevOps Manager’ in Denver.”