《openEuler部署DeepSeek全攻略》

DeepSeek专栏1:openEuler部署DeepSeek全攻略档

系统环境硬件要求

![image-20250509152626780](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250509152626780.png?lastModify=1746860634)

使用Ollama推理框架的DeepSeek部署过程 方式一:自动部署方式 以下部署流程是在openEuler 24.03 LTS版本上使用Ollama推理框架部署DeepSeek-R1-Distill-Qwen-7B的流程。注意:该方式可能会存在下载速度缓慢的问题,后面提供了手动下载部署安装的方式,便于在网络环境不好的情况下进行部署安装。

Ollama下载安装采用Ollama官网下载方式:

curl -fsSL https://ollama.com/install.sh | sh

![image-20250509101748804](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250509101748804.png?lastModify=1746860634)

Ollama部署DeepSeek-R1-Distill-Qwen-1.5B

ollama run deepseek-r1:1.5b

![image-20250509101856408](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250509101856408.png?lastModify=1746860634)

可以问一些问题进行测试

![image-20250509101913725](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250509101913725.png?lastModify=1746860634)

openEuler 24.03-LTS-SP1安装docker

Docker部署(个人推荐方式)

#获取镜像
docker pull ghcr.io/open-webui/open-webui:main
#国内网络因素,如果拉取不下来可以用下面的命令拉取
docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/open-webui/open-webui:latest

镜像拉取成功后就可以启动镜像了

拉取github官方镜像的启动,可以将3000改为你想要监听的外部端口

docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui ghcr.io/open-webui/open-webui:main

数据卷映射 (Volume Mapping: -v
open-webui:/app/backend/data):确保数据持久化存储,防止容器重启时数据丢失。 端口映射 (Port
Mapping: -p 3000:8080):将 WebUI 暴露在本地机器的 3000 端口上。
要启用 Nvidia GPU 支持,在 docker run 命令中添加 --gpus all

docker run -d -p 3000:8080 --gpus all -v open-webui:/app/backend/data --name open-webui Package open-webui · GitHub

如果是其他源拉取的镜像最好先给镜像改个名,以上述拉取的源为例拉取后镜像名字为:swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/open-webui/open-webui

![image-20250510144911567](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510144911567.png?lastModify=1746860634) 修改保存之后,记得重启 docker 服务。

systemctl daemon-reload
systemctl restart docker

![image-20250510144404831](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510144404831.png?lastModify=1746860634)

部署OpenWebUI

容器化部署OpenWebUI

docker run -d
–network=host
-v open-webui:/app/backend/data
-e OLLAMA_BASE_URL=http://127.0.0.1:11434
–name open-webui
–restart always
ghcr.io/open-webui/open-webui:main

![image-20250510145338885](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510145338885.png?lastModify=1746860634)

修改 Ollama 配置文件:

sudo vim /etc/systemd/system/ollama.service

在 [Service] 部分添加环境变量,使其监听所有接口:
Environment=“OLLAMA_HOST=0.0.0.0:11434”

![image-20250509102104301](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250509102104301.png?lastModify=1746860634)

重启 Ollama

sudo systemctl daemon-reload
sudo systemctl restart ollama

![image-20250510145013235](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510145013235.png?lastModify=1746860634)

验证OpenWebUI安装

浏览器访问:http://192.168.74.112:8080打开 Open WebUI 页面。

  • 首先需要设置用户账号信息创建管理员账号

![image-20250510145146678](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510145146678.png?lastModify=1746860634)

  • 登录成功后,进入首页![image-20250510145231791](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510145231791.png?lastModify=1746860634)

  • 选择大模型

![image-20250510145117688](file://C:/Users/29582/AppData/Roaming/Typora/typora-user-images/image-20250510145117688.png?lastModify=1746860634)

  • 对话交互