This commit is contained in:
c121914yu
2025-04-17 05:08:06 +00:00
parent 1ac54b002e
commit 2a17afff73
12 changed files with 21615 additions and 223 deletions

View File

@@ -47,7 +47,7 @@ ollama serve #安装完成后,使用该命令启动服务</code>
ollama serve #安装完成后,同样启动服务</code>
</pre></div><h4 id=windows>Windows <a href=#windows class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><p>在 Windows 系统中,你可以从 Ollama 官方网站 下载 Windows 版本的安装程序。下载完成后,运行安装程序,按照安装向导的提示完成安装。安装完成后,在命令提示符或 PowerShell 中启动服务:</p><div class=prism-codeblock><pre id=f9708e1 class=language-bash>
<code>ollama serve #安装完成并启动服务后,你可以在浏览器中访问 http://localhost:11434 来验证 Ollama 是否安装成功。</code>
</pre></div><h4 id=补充说明>补充说明 <a href=#%e8%a1%a5%e5%85%85%e8%af%b4%e6%98%8e class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><p>如果你是采用的主机应用 Ollama 而不是镜像,需要确保你的 Ollama 可以监听0.0.0.0。</p><h5 id=1-linxu-系统>1. Linxu 系统 <a href=#1-linxu-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>如果 Ollama 作为 systemd 服务运行,打开终端,编辑 Ollama 的 systemd 服务文件使用命令sudo systemctl edit ollama.service在[Service]部分添加Environment=&ldquo;OLLAMA_HOST=0.0.0.0&rdquo;。保存并退出编辑器然后执行sudo systemctl daemon - reload和sudo systemctl restart ollama使配置生效。</p><h5 id=2-macos-系统>2. MacOS 系统 <a href=#2-macos-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>打开终端使用launchctl setenv ollama_host &ldquo;0.0.0.0"命令设置环境变量,然后重启 Ollama 应用程序以使更改生效。</p><h5 id=3-windows-系统>3. Windows 系统 <a href=#3-windows-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>通过 “开始” 菜单或搜索栏打开 “编辑系统环境变量”,在 “系统属性” 窗口中点击 “环境变量”,在 “系统变量” 部分点击 “新建”创建一个名为OLLAMA_HOST的变量变量值设置为0.0.0.0,点击 “确定” 保存更改,最后从 “开始” 菜单重启 Ollama 应用程序。</p><h3 id=ollama-拉取模型镜像>Ollama 拉取模型镜像 <a href=#ollama-%e6%8b%89%e5%8f%96%e6%a8%a1%e5%9e%8b%e9%95%9c%e5%83%8f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>在安装 Ollama 后,本地是没有模型镜像的,需要自己去拉取 Ollama 中的模型镜像。命令如下:</p><div class=prism-codeblock><pre id=c725436 class=language-bash>
</pre></div><h4 id=补充说明>补充说明 <a href=#%e8%a1%a5%e5%85%85%e8%af%b4%e6%98%8e class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><p>如果你是采用的主机应用 Ollama 而不是镜像,需要确保你的 Ollama 可以监听0.0.0.0。</p><h5 id=1-linxu-系统>1. Linxu 系统 <a href=#1-linxu-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>如果 Ollama 作为 systemd 服务运行,打开终端,编辑 Ollama 的 systemd 服务文件使用命令sudo systemctl edit ollama.service在[Service]部分添加Environment=&ldquo;OLLAMA_HOST=0.0.0.0&rdquo;。保存并退出编辑器然后执行sudo systemctl daemon - reload和sudo systemctl restart ollama使配置生效。</p><h5 id=2-macos-系统>2. MacOS 系统 <a href=#2-macos-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>打开终端使用launchctl setenv ollama_host &ldquo;0.0.0.0"命令设置环境变量,然后重启 Ollama 应用程序以使更改生效。</p><h5 id=3-windows-系统>3. Windows 系统 <a href=#3-windows-%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>通过 “开始” 菜单或搜索栏打开 “编辑系统环境变量”,在 “系统属性” 窗口中点击 “环境变量”,在 “系统变量” 部分点击 “新建”创建一个名为OLLAMA_HOST的变量变量值设置为0.0.0.0,点击 “确定” 保存更改,最后从 “开始” 菜单重启 Ollama 应用程序。</p><h3 id=ollama-拉取模型镜像>Ollama 拉取模型镜像 <a href=#ollama-%e6%8b%89%e5%8f%96%e6%a8%a1%e5%9e%8b%e9%95%9c%e5%83%8f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>在安装 Ollama 后,本地是没有模型镜像的,需要自己去拉取 Ollama 中的模型镜像。命令如下:</p><div class=prism-codeblock><pre id=c725436 class=language-bash>
<code># Docker 部署需要先进容器,命令为: docker exec -it &lt; Ollama 容器名 &gt; /bin/sh
ollama pull &lt;模型名&gt;</code>
</pre></div><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/Ollama-pull.png alt loading=lazy class=medium-zoom-image></p><h3 id=测试通信>测试通信 <a href=#%e6%b5%8b%e8%af%95%e9%80%9a%e4%bf%a1 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>在安装完成后,需要进行检测测试,首先进入 FastGPT 所在的容器,尝试访问自己的 Ollama ,命令如下:</p><div class=prism-codeblock><pre id=e834756 class=language-bash>