完整安装步骤(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"
}
}
}
}
第八步:测试
# 停止 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)推断位置并查询天气