OpenClaw + Ollama 安装指南

环境准备

Windows 下基于 WSL2 安装 Ubuntu 22.04

系统环境:Windows 11

1. 启用 WSL 功能

# 启用 WSL 功能

wsl --install



# 安装指定版本的 Ubuntu

wsl --install -d Ubuntu-22.04

2. WSL 系统迁移(可选)

如果 C 盘空间不足,可以将 WSL 系统导出到其他磁盘:


# 导出当前运行的系统

wsl --export <发行版名称> <导出路径.tar>



# 示例:导出 Ubuntu 到 D 盘

wsl --export Ubuntu D:\ubuntu_backup.tar



# 基本导入命令

wsl --import <新发行版名称> <安装路径> <tar文件路径>



# 示例:导入到 D:\WSL\Ubuntu

wsl --import UbuntuNew D:\WSL\Ubuntu D:\ubuntu_backup.tar

Ollama 安装与配置

快速安装 Ollama

经过多种尝试,以下命令安装速度最快:


curl -fsSL https://aliendao.cn/ollama/install.sh | sh

模型选择

您可以在 Ollama 模型库 中选择适合自己的模型,建议选择支持 tools 功能的模型。

拉取模型

以 Llama 3.2 为例:


ollama pull llama3.2:latest

模型使用建议

经过实际测试,不推荐使用本地模型,最终选择了火山引擎的 Code Plan 包月云模型,使用体验显著提升。

OpenClaw 安装与配置

安装 OpenClaw

脚本会自动判断当前系统环境:


curl -fsSL https://openclaw.ai/install.sh | bash

初始化配置

执行以下命令开始配置过程:


openclaw onboard --install-daemon

配置选项说明

执行命令后会出现一系列配置选项:

1. 网关运行位置

◆  Where will the Gateway run?

│  ● Local (this machine) (No gateway detected (ws://127.0.0.1:18789))

│  ○ Remote (info-only)

建议:99% 的本地部署场景选择 “Local” 选项。

2. 配置部分选择

◆  Select sections to configure

│  ● Workspace (Set workspace + sessions)

│  ○ Model

│  ○ Web tools

│  ○ Gateway

│  ○ Daemon

│  ○ Channels

│  ○ Skills

│  ○ Health check

│  ○ Continue

说明:此环节用于配置工作空间、模型选择、网页工具、网关、守护进程、通道、技能和心跳检测。

建议:设置好工作空间和模型后,基本可以一路选择 “Continue” 完成配置。

创建和配置 Agents

创建新的 Agent


openclaw agents add xxx --workspace ~/.openclaw/workspace/xxx --model "volcengine-plan/ark-code-latest"

设置 Agent 名称


openclaw agents set-identity --agent xxx --name "xxx"

访问和使用

在浏览器中访问 127.0.0.1:18789,即可看到新创建的 Agent。

个性化配置

通过与 Agent 对话,可以为其配置工作内容、性格特点等。

Logo

欢迎加入 MCP 技术社区!与志同道合者携手前行,一同解锁 MCP 技术的无限可能!

更多推荐