学习AI—1—ollama

本地部署模型

Ollama

  • 下载
  1. 官网:https://ollama.com/download/windows  因为是直接从境外服务器下载,比较慢
  2. 联想应用商店:https://lestore.lenovo.com/detail/L118505  比较快
  • 安装:
  1. 直接点击安装(默认C盘)
  2. 命令行安装指定路径  OllamaSetup.exe /DIR=指定路径
  3. 安装成功后浏览器访问http://127.0.0.1:11434/ 出现下面提示表示安装成功

    image

  • 使用:

    git clone https://github.com/ollama/ollama  or git clone https://gh-proxy.com/https://github.com/ollama/ollama 

    还可添加  https://ghproxy.net/、https://githubproxy.cc/

    API: docs/api.md

  嵌入模型,导入文件(如果ollama pull过慢,退出多试几次, ollama 支持断点续传)
 ollama pull bge-m3
 ollama pull nomic-embed-text

Docker

  • 下载:

    官网:https://www.docker.com/get-started/

image

  •  安装

  Window环境 设置

    image

   WSL、OS

PowerShell: 
  wsl --install 比较慢, 可 wsl --install --no-distribution
  在线安装发行版(慢)
    wsl --install -d Ubuntu-26.04 --name ubuntu-26.04 --location D:\wsl
  本地安装(快)     wsl --install --from-file .\ubuntu-26.04-wsl-amd64.wsl --name Ubuntu-26.04 --location D:\wsl\ubuntu2604

Dify

  git clone https://github.com/langgenius/dify  or git clone https://gh-proxy.com/https://github.com/langgenius/dify

  复制 .env.example文件,命名为.env  添加

CUSTOM_MODEL_ENABLED=true
OLLAMA_API_BASE_URL=host.docker.internal:11434
  在路径dify\docker>执行命令  docker compose up -d
  执行成功访问http://127.0.0.1/ 进入Dify,首次访问要注册
  dify 添加ollama的model 时 *填写 http://host.docker.internal:11434
posted @ 2026-09-19 12:30  leck  阅读(28)  评论(0)    收藏  举报