<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>本地大模型 &#8211; 孙威的阳光海</title>
	<atom:link href="https://www.sunnyfly.com/tag/%e6%9c%ac%e5%9c%b0%e5%a4%a7%e6%a8%a1%e5%9e%8b/feed" rel="self" type="application/rss+xml" />
	<link>https://www.sunnyfly.com</link>
	<description>人生没有终极意义，只有那些过程中的好时光。</description>
	<lastBuildDate>Tue, 12 May 2026 03:44:55 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.sunnyfly.com/wp-content/uploads/2019/07/cropped-wyat-32x32.jpg</url>
	<title>本地大模型 &#8211; 孙威的阳光海</title>
	<link>https://www.sunnyfly.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Windows本地部署大模型 Ollama + OpenWebUI 最佳实践指南</title>
		<link>https://www.sunnyfly.com/llm-ollama-openwebui.html</link>
					<comments>https://www.sunnyfly.com/llm-ollama-openwebui.html#respond</comments>
		
		<dc:creator><![CDATA[孙威]]></dc:creator>
		<pubDate>Tue, 12 May 2026 03:40:36 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[ai]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[Ollama]]></category>
		<category><![CDATA[OpenWebUI]]></category>
		<category><![CDATA[本地大模型]]></category>
		<guid isPermaLink="false">https://www.sunnyfly.com/?p=3290</guid>

					<description><![CDATA[前言 现在各种AI Chat已经非常好用了，比如御...]]></description>
										<content:encoded><![CDATA[<h2>前言</h2>
<p>现在各种AI Chat已经非常好用了，比如御三家Claude、Gemini和ChatGPT，还比如国内的元宝、豆包和Deekseek，完全够用了。但大模型已经不再是云端的专属。得益于 Ollama 和 OpenWebUI 这两个开源项目，你完全可以在自己的电脑上运行 Llama 3、Qwen、Gemma 等主流大模型，且整个部署过程不超过 30 分钟。当然，本地部署大模型主要用来学习或demo，肯定是无法生产的。</p>
<p>本地部署的核心优势：</p>
<p>数据隐私：所有对话数据留在本地，不经过任何第三方服务器。<br />
零成本推理：不依赖 API 计费，无限次调用。<br />
离线可用：部署完成后，断网也能正常对话。<br />
完全可控：自由选择模型、调整参数、决定升级节奏。</p>
<p>本文将带你从零开始，在 Windows 上完成 Ollama + OpenWebUI 的完整部署。</p>
<h2>架构概览</h2>
<p>整个方案由两部分组成：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="raw">┌─────────────────┐        HTTP API         ┌──────────────┐
│   Open WebUI    │ ◄──── localhost:11434 ──►│    Ollama   │
│  (前端界面)      │                         │  (推理引擎)  │
│  localhost:3000 │                         │  本地模型运行 │
└─────────────────┘                         └──────────────┘
</pre>

<table id="tablepress-1" class="tablepress tablepress-id-1">
<thead>
<tr class="row-1">
	<th class="column-1"><strong>组件</strong></th><th class="column-2"><strong>组件</strong></th><th class="column-3"><strong>技术栈</strong></th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">Ollama</td><td class="column-2">模型下载、管理、推理引擎</td><td class="column-3">Go + llama.cpp</td>
</tr>
<tr class="row-3">
	<td class="column-1">OpenWebUI</td><td class="column-2">浏览器端交互界面</td><td class="column-3">Python + Svelte</td>
</tr>
</tbody>
</table>
<!-- #tablepress-1 from cache -->
<p>两者通过 Ollama 暴露的 REST API（默认端口 <code class="codespan max-w-full cursor-pointer break-words">11434</code>）通信，Open WebUI 提供类 ChatGPT 的使用体验。</p>
<h2>硬件要求</h2>
<p>在开始之前，先确认你的硬件条件：<br />

<table id="tablepress-2" class="tablepress tablepress-id-2">
<thead>
<tr class="row-1">
	<th class="column-1">配置层级</th><th class="column-2">GPU</th><th class="column-3">显存</th><th class="column-4">内存</th><th class="column-5">适合运行的模型</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">入门</td><td class="column-2">无独显</td><td class="column-3">—</td><td class="column-4">16GB</td><td class="column-5">7B 量化模型（CPU 推理，速度较慢）</td>
</tr>
<tr class="row-3">
	<td class="column-1">推荐</td><td class="column-2">RTX 4060</td><td class="column-3">12GB</td><td class="column-4">16GB</td><td class="column-5">7B ~ 14B</td>
</tr>
<tr class="row-4">
	<td class="column-1">理想</td><td class="column-2">RTX 5060 Ti+</td><td class="column-3">16GB+</td><td class="column-4">32GB</td><td class="column-5">14B ~ 70B</td>
</tr>
</tbody>
</table>
<!-- #tablepress-2 from cache -->
<blockquote><p>关键指标：模型参数量决定了显存需求。7B 模型（Q4 量化）约需 4~5GB 显存，13B 约需 8~10GB。</p></blockquote>
<h2>安装 Ollama</h2>
<p>下载：<a href="https://ollama.com/download/windows">Download Ollama on Windows</a></p>
<p>安装：直接双击安装文件即可成功安装</p>
<p>完成后打开 <strong>PowerShell</strong> 验证：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="powershell">ollama --version</pre>
<p>验证 Ollama 运行：安装完成后，Ollama 会在 <code class="codespan max-w-full cursor-pointer break-words">localhost:11434</code> 启动一个 API 服务。验证方式：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="powershell">curl http://localhost:11434
# 预期输出：Ollama is running</pre>
<p>建议配置：在 setting 的模型位置改为 其他盘 以免默认占用C盘空间</p>
<h2>下载第一个本地大模型</h2>
<p>常用模型推荐</p>

<table id="tablepress-3" class="tablepress tablepress-id-3">
<thead>
<tr class="row-1">
	<th class="column-1">模型</th><th class="column-2">大小</th><th class="column-3">特点</th><th class="column-4">推荐场景</th>
</tr>
</thead>
<tbody class="row-striping row-hover">
<tr class="row-2">
	<td class="column-1">qwen2.5:7b</td><td class="column-2">4.7GB</td><td class="column-3">中文能力强，综合表现均衡</td><td class="column-4">日常中文对话</td>
</tr>
<tr class="row-3">
	<td class="column-1">llama3:8b</td><td class="column-2">4.7GB</td><td class="column-3">Meta 出品，英文能力突出</td><td class="column-4">英文写作、代码</td>
</tr>
<tr class="row-4">
	<td class="column-1">deepseek-coder-v2:16b</td><td class="column-2">8.9GB</td><td class="column-3">代码能力极强</td><td class="column-4">编程辅助</td>
</tr>
<tr class="row-5">
	<td class="column-1">phi3:mini</td><td class="column-2">2.3GB</td><td class="column-3">微软出品，体积极小</td><td class="column-4">低配机器、快速响应</td>
</tr>
<tr class="row-6">
	<td class="column-1">gemma2:9b</td><td class="column-2">5.4GB</td><td class="column-3">Google 出品，推理能力强</td><td class="column-4">逻辑推理任务</td>
</tr>
</tbody>
</table>
<!-- #tablepress-3 from cache -->
<p>拉取模型</p>
<pre class="EnlighterJSRAW" data-enlighter-language="powershell"># 下载 Qwen3.5 9B（中文表现优秀，推荐）
ollama pull qwen9.5:9b
</pre>
<h2>安装 OpenWebUI</h2>
<p>因为踩过坑，不建议用docker安装，直接pip安装吧</p>
<pre class="EnlighterJSRAW" data-enlighter-language="powershell"># 建议先创建虚拟环境
python3 -m venv open-webui-env
source open-webui-env/bin/activate  # Windows: open-webui-env\Scripts\activate

# 安装
pip install open-webui

# 启动
open-webui serve</pre>
<p>默认访问地址：<code class="codespan max-w-full cursor-pointer break-words">http://localhost:8080</code></p>
<blockquote><p>注意：pip 安装需要 Python 3.11+，且部分依赖在 Windows 上可能需要额外配置。</p></blockquote>
<p>首次访问与注册</p>
<ol class="relative">
<li>浏览器打开 <code class="codespan max-w-full cursor-pointer break-words">http://localhost:8080</code>（pip 部署）</li>
<li>首次访问需要 <strong>注册管理员账号</strong>（数据存储在本地，无需邮箱验证）</li>
<li>登录后，界面会自动检测 Ollama 中已安装的模型</li>
</ol>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-3302" src="https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index.jpg" alt="" width="2534" height="1161" srcset="https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index.jpg 2534w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-1920x880.jpg 1920w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-425x195.jpg 425w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-768x352.jpg 768w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-1536x704.jpg 1536w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-2048x938.jpg 2048w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-100x46.jpg 100w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-700x321.jpg 700w, https://www.sunnyfly.com/wp-content/uploads/2026/05/openwebui-index-1600x733.jpg 1600w" sizes="(max-width: 2534px) 100vw, 2534px" /></p>
<p>Ollama 环境变量：通过windows环境变量可以调优 Ollama 的行为</p>
<pre class="EnlighterJSRAW" data-enlighter-language="raw"># 监听所有网络接口（允许局域网访问）
OLLAMA_HOST=0.0.0.0:11434

# 设置模型加载后在内存中保留的时间（默认 5m）
OLLAMA_KEEP_ALIVE=30m

# 并发请求数
OLLAMA_NUM_PARALLEL=4

# GPU 层数分配（混合推理时使用）
OLLAMA_NUM_GPU=30</pre>
<p>当然，Ollama 支持通过 Modelfile 定制模型行为，类似 Dockerfile，这里我就不赘述了。</p>
<p>另外，如果你是个编程爱好者，还可以在 IDE 中使用，许多 IDE 插件支持 Ollama，比如我用的VS Code的Continue</p>
<h2>总结</h2>
<p>至此，你已经拥有了一套完整的本地大模型运行环境：</p>
<ul>
<li>完全私密的 AI 对话</li>
<li>多模型自由切换</li>
<li>美观的 Web 界面</li>
<li>兼容 OpenAI API</li>
</ul>
<p>参考资料：</p>
<ul>
<li>Ollama 官网：<span class="inline-flex cursor-pointer items-center text-left leading-6 text-blue-600 no-underline focus:outline-none" tabindex="0" role="link"><span class="ml-1">https://ollama.com</span></span></li>
<li>Ollama 模型库：<span class="inline-flex cursor-pointer items-center text-left leading-6 text-blue-600 no-underline focus:outline-none" tabindex="0" role="link"><span class="ml-1">https://ollama.com/library</span></span></li>
<li>Open WebUI 文档：<span class="inline-flex cursor-pointer items-center text-left leading-6 text-blue-600 no-underline focus:outline-none" tabindex="0" role="link"><span class="ml-1">https://docs.openwebui.com</span></span></li>
<li>Open WebUI GitHub：<span class="inline-flex cursor-pointer items-center text-left leading-6 text-blue-600 no-underline focus:outline-none" tabindex="0" role="link"><span class="ml-1">https://github.com/open-webui/open-webui</span></span></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sunnyfly.com/llm-ollama-openwebui.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
