跳到主要内容
极客日志极客日志面向AI+效率的开发者社区
首页博客GitHub 精选镜像AI 生图工具UI配色美学隐私政策关于联系
搜索内容 / 工具 / 仓库 / 镜像...⌘K搜索
注册
博客列表
Shell / BashAI

Ubuntu 22.04 安装与配置 Openclaw 教程

介绍在 Ubuntu 22.04 系统上安装和配置 Openclaw 的详细步骤。内容包括通过脚本一键安装,配置飞书和钉钉等聊天机器人通道,以及接入 GLM-4.7-Flash、DeepSeek、MiniMax 等多个大模型 API。此外,还讲解了如何集成 Exa 搜索引擎以增强 AI 员工的网络检索能力,并提供相关配置文件修改和命令行操作指南,帮助用户快速搭建本地 AI 助手环境。

乱七八糟发布于 2026/4/6更新于 2026/7/2149 浏览
Ubuntu 22.04 安装与配置 Openclaw 教程

Ubuntu 22.04 安装与配置 Openclaw 教程

准备工作

一键安装

使用官方脚本进行安装:

curl -fsSL https://clawd.org.cn/install.sh | sudo bash

按提示输入 Y 确认安装。

安装过程中需要配置 DeepSeek API Key。访问 https://platform.deepseek.com/sign_in 注册并获取 API Key,在终端中输入 key。

设置通道 配置飞书

需要创建飞书机器人。

  1. 访问 https://open.feishu.cn,进入开发者后台。
  2. 注册用户并创建 AI 机器人。
  3. 创建好后获取 App ID 和 App Secret。
  4. 在安装终端中填入 App ID 和 Secret。
  5. 后续可单独输入命令 openclaw-cn configure --section channels 进行配置。

如果有问题,运行 openclaw-cn onboard --install-daemon 重新配置。

若 Gateway 未安装导致无法打开网页端,执行以下命令安装必备工具:

sudo apt install net-tools

让 ai 员工更好用

加入免费的模型

配置 GLM-4.7-Flash 官方免费 API。

  1. 访问 https://bigmodel.cn/ 注册开发者并获取 API Key。
  2. 在控制台新建 API Key 并复制。
  3. 在 openclaw.json 文件中写入配置:
{
  "models": {
    "providers": {
      "glm": {
        "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
        "apiKey": "你的 apiKey",
         
         
          
             
             
             
             
             
             
             
               
               
               
               
            
          
        
      
    
  
   
     
       
         
      
       
       
         
      
    
  

"api"
:
"openai-completions"
,
"models"
:
[
{
"id"
:
"glm-4.7-flash"
,
"name"
:
"GLM-4.7 Flash"
,
"contextWindow"
:
128000
,
"maxTokens"
:
4096
,
"reasoning"
:
false
,
"input"
:
[
"text"
]
,
"cost"
:
{
"input"
:
0
,
"output"
:
0
,
"cacheRead"
:
0
,
"cacheWrite"
:
0
}
}
]
}
}
}
,
"agents"
:
{
"defaults"
:
{
"model"
:
{
"primary"
:
"glm/glm-4.7-flash"
}
,
"maxConcurrent"
:
4
,
"subagents"
:
{
"maxConcurrent"
:
8
}
}
}
}

重启 Openclaw:

openclaw-cn gateway restart

配置钉钉

  1. 访问 https://open-dev.dingtalk.com 在钉钉开发者平台获取 Client ID (AppKey) 和 Client Secret (AppSecret)。
  2. 在权限管理中搜索并添加权限:Card.Instance.Write, Card.Streaming.Write, im:message。
  3. 安装钉钉插件(OpenClaw 默认未内置):
openclaw-cn plugins install https://github.com/soimy/clawdbot-channel-dingtalk.git

在 GLM-4.7-Flash 基础上加入 DeepSeek

修改 openclaw.json 配置文件,加入 DeepSeek API Key。当 GLM-4.7-Flash 免费 token 不足时自动切换。

重启服务:

openclaw-cn gateway restart

加入 MiniMax 和豆包模型

  1. MiniMax: 访问 https://api.minimax.chat/ 注册登录获取 API Key。
  2. Seedance2.0 (豆包): 访问 https://console.volcengine.com/ark 开通火山方舟服务,在 API Key 管理页面创建 Key。
  3. 之后配置 openclaw.json 即可接入多个大模型。

配置 Web 搜索

使用 Exa.ai 进行网络搜索。

  1. 访问 https://exa.ai/ 免费注册。
  2. 登录后获取 API Key。
  3. 将 API Key 告知 Openclaw 进行配置,或手动设置环境变量。
.env File
EXA_API_KEY=YOUR_API_KEY
🔌 Exa MCP Server for OpenAI Codex

给 OpenAI Codex 提供实时 Web 搜索功能。

运行命令:

codex mcp add exa --url https://mcp.exa.ai/mcp?exaApiKey=f2492f04-b9f0-4c09-86a5-1ce6e1b9a24a

启用特定工具:

https://mcp.exa.ai/mcp?exaApiKey=f2492f04-b9f0-4c09-86a5-1ce6e1b9a24a&tools=web_search_exa,get_code_context_exa,people_search_exa

启用所有工具:

https://mcp.exa.ai/mcp?exaApiKey=f2492f04-b9f0-4c09-86a5-1ce6e1b9a24a&tools=web_search_exa,web_search_advanced_exa,get_code_context_exa,crawling_exa,company_research_exa,people_search_exa,deep_researcher_start,deep_researcher_check
Quick Start

cURL:

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "latest developments in AI safety research", "type": "auto", "num_results": 10, "contents": { "text": { "max_characters": 20000 } } }'
Function Calling / Tool Use

函数调用允许 AI 智能体根据上下文动态决定何时搜索网络。

OpenAI Function Calling:

import json
from openai import OpenAI
from exa_py import Exa

openai = OpenAI()
exa = Exa()

tools = [{"type":"function","function":{"name":"exa_search","description":"Search the web for current information.","parameters":{"type":"object","properties":{"query":{"type":"string","description":"Search query"}},"required":["query"]}}},
{"def exa_search(query:str)->str:
    results = exa.search_and_contents(query,type="auto", num_results=10, text={"max_characters":20000})
    return "\n".join([f"{r.title}: {r.url}" for r in results.results])

messages = [{"role":"user","content":"What's the latest in AI safety?"}]
response = openai.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
if response.choices[0].message.tool_calls:
    tool_call = response.choices[0].message.tool_calls[0]
    search_results = exa_search(json.loads(tool_call.function.arguments)["query"])
    messages.append(response.choices[0].message)
    messages.append({"role":"tool","tool_call_id": tool_call.id,"content": search_results})
final = openai.chat.completions.create(model="gpt-4o", messages=messages)
print(final.choices[0].message.content)

Anthropic Tool Use:

import anthropic
from exa_py import Exa

client = anthropic.Anthropic()
exa = Exa()

tools = [{"name":"exa_search","description":"Search the web for current information.","input_schema":{"type":"object","properties":{"query":{"type":"string","description":"Search query"}},"required":["query"]}}]

def exa_search(query:str)->str:
    results = exa.search_and_contents(query,type="auto", num_results=10, text={"max_characters":20000})
    return "\n".join([f"{r.title}: {r.url}" for r in results.results])

messages = [{"role":"user","content":"Latest quantum computing developments?"}]
response = client.messages.create(model="claude-sonnet-4-20250514", max_tokens=4096, tools=tools, messages=messages)
if response.stop_reason == "tool_use":
    tool_use = next(b for b in response.content if b.type=="tool_use")
    tool_result = exa_search(tool_use.input["query"])
    messages.append({"role":"assistant","content": response.content})
    messages.append({"role":"user","content":[{"type":"tool_result","tool_use_id": tool_use.id,"content": tool_result}]})
final = client.messages.create(model="claude-sonnet-4-20250514", max_tokens=4096, tools=tools, messages=messages)
print(final.content[0].text)
Search Type Reference
TypeBest ForSpeedDepth
fastReal-time apps, autocomplete, quick lookupsFastestBasic
autoMost queries - balanced relevance & speedMediumSmart
deepResearch, enrichment, thorough resultsSlowDeep
deep-reasoningComplex research, multi-step reasoningSlowestDeepest

Tip: type="auto" works well for most queries. Use type="deep" when you need thorough research results.

Content Configuration

Choose ONE content type per request:

TypeConfigBest For
Text"text": {"max_characters": 20000}Full content extraction, RAG
Highlights"highlights": {"max_characters": 4000}Snippets, summaries, lower cost

Warning: Using text: true can significantly increase token count. Add max_characters limit or use highlights.

Domain Filtering (Optional)

Example:

{"includeDomains":["arxiv.org","github.com"],"excludeDomains":["pinterest.com"]}
Web Search Tool
{"query":"latest developments in AI safety research","num_results":10,"contents":{"text":{"max_characters":20000}}}

Tips:

  • Use type: "auto" for most queries.
  • Great for building search-powered chatbots or agents.
  • Combine with contents for RAG workflows.
Category Examples

Use category filters to search dedicated indexes.

People Search (category: "people"):

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "software engineer distributed systems", "category": "people", "type": "auto", "num_results": 10 }'

Company Search (category: "company"):

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "AI startup healthcare", "category": "company", "type": "auto", "num_results": 10 }'

News Search (category: "news"):

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "OpenAI announcements", "category": "news", "type": "auto", "num_results": 10, "contents": { "text": { "max_characters": 20000 } } }'

Research Papers (category: "research paper"):

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "transformer architecture improvements", "category": "research paper", "type": "auto", "num_results": 10, "contents": { "text": { "max_characters": 20000 } } }'

Tweet Search (category: "tweet"):

curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "AI safety discussion", "category": "tweet", "type": "auto", "num_results": 10, "contents": { "text": { "max_characters": 20000 } } }'
Content Freshness (maxAgeHours)

maxAgeHours sets the maximum acceptable age for cached content.

ValueBehaviorBest For
24Use cache if less than 24 hours old, otherwise livecrawlDaily-fresh content
1Use cache if less than 1 hour old, otherwise livecrawlNear real-time data
0Always livecrawl (ignore cache entirely)Real-time data where cached content is unusable
-1Never livecrawl (cache only)Maximum speed, historical/static content
(omit)Default behaviorRecommended — balanced speed and freshness
Other Endpoints
EndpointDescriptionDocs
/contentsGet contents for known URLsDocs
/answerQ&A with citations from web searchDocs

Example - Get contents for URLs:

POST /contents
{"urls":["https://example.com/article"],"text":{"max_characters":20000}}
Troubleshooting

Results not relevant?

  1. Try type: "auto" - most balanced option.
  2. Try type: "deep" - runs multiple query variations.
  3. Refine query - use singular form, be specific.
  4. Check category matches your use case.

Need structured data from search?

  1. Use type: "deep" or type: "deep-reasoning" with outputSchema.

Results too slow?

  1. Use type: "fast".
  2. Reduce num_results.
  3. Skip contents if you only need URLs.

No results?

  1. Remove filters (date, domain restrictions).
  2. Simplify query.
  3. Try type: "auto".
Resources
  • Docs: https://exa.ai/docs
  • Dashboard: https://dashboard.exa.ai
  • API Status: https://status.exa.ai

目录

  1. Ubuntu 22.04 安装与配置 Openclaw 教程
  2. 准备工作
  3. 一键安装
  4. 设置通道 配置飞书
  5. 让 ai 员工更好用
  6. 加入免费的模型
  7. 配置钉钉
  8. 在 GLM-4.7-Flash 基础上加入 DeepSeek
  9. 加入 MiniMax 和豆包模型
  10. 配置 Web 搜索
  11. .env File
  12. 🔌 Exa MCP Server for OpenAI Codex
  13. Quick Start
  14. Function Calling / Tool Use
  15. Search Type Reference
  16. Content Configuration
  17. Domain Filtering (Optional)
  18. Web Search Tool
  19. Category Examples
  20. Content Freshness (maxAgeHours)
  21. Other Endpoints
  22. Troubleshooting
  23. Resources
  • 免费图片AI生成工具免费生成了解详情
  • Magick API 一键接入全球大模型注册送1000万token查看
  • 免费图片视频在线生成30秒,将你的创意变成现实开始设计
  • X/Twitter免费视频下载器免登陆无限额度免费视频解析下载了解详情
  • 100+免费在线小游戏爽一把
极客日志微信公众号二维码

微信扫一扫,关注极客日志

微信公众号「极客日志V2」,在微信中扫描左侧二维码关注。展示文案:极客日志V2 zeeklog

更多推荐文章

查看全部
  • JVM 运行时数据区域详解与内存结构分析
  • Python 微信小程序班级学生奖惩成绩信息管理系统
  • Python 自然语言处理实战:基于《红楼梦》的文本挖掘与关键词提取
  • 注意力机制与 Transformer 模型实战
  • TeleGrip:基于 VR 的机械臂遥操作系统架构与源码解析
  • uniapp+python微信小程序毕业生招聘平台
  • MacOS 下使用 Docker 极简安装 OpenClaw 并对接飞书
  • Xilinx PCIe IP 核详解、FPGA 实现及仿真全流程 (Virtex-7 Gen3)
  • Spring 整合 Apollo 配置中心
  • 相干伊辛机在医疗及 AI 领域的应用前景
  • 大模型场景下的向量数据库选型分析
  • FAIR plus 机器人全产业链接会概览
  • Python 同时适配 Elasticsearch 与 Easysearch 实战复盘
  • 深度解析 OpenVR、OpenXR、SteamVR 与厂商 SDK 的核心差异
  • DirectShow 技术在 AR/VR 实时视频合成中的应用实践
  • 异构数据迁移工具:DataX 与 DataX-Web 使用指南
  • 基于代价模型的连接条件下推优化技术
  • SketchUp STL 插件:从虚拟设计到实体打印的转换指南
  • AI 大模型技术白皮书:发展趋势、挑战与展望
  • 使用 Java 实现简单高效的任务调度框架

相关免费在线工具

  • RSA密钥对生成器

    生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online

  • Mermaid 预览与可视化编辑

    基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online

  • 随机西班牙地址生成器

    随机生成西班牙地址(支持马德里、加泰罗尼亚、安达卢西亚、瓦伦西亚筛选),支持数量快捷选择、显示全部与下载。 在线工具,随机西班牙地址生成器在线工具,online

  • Base64 字符串编码/解码

    将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online

  • Base64 文件转换器

    将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online

  • Markdown转HTML

    将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online