Docker 运行RAGFlow 搭建RAG知识库

借鉴视频:DeepSeek 10分钟完全本地部署 保姆级教程 断网运行 无惧隐私威胁 大语言模型 CPU GPU 混合推理32B轻松本地部署!DeepSeek模拟王者!!_哔哩哔哩_bilibili

借鉴博客:RAGFlow搭建全攻略:从入门到精通,轻松构建RAG知识库-CSDN博客

环境要求:RAGFlow 运行内存需要 > 8G,硬盘需要 > 20G,CPU 内核 > 4

运行性能展示:

本地部署的环境: ollama 部署在 window 本地, RAGFlow 部署在虚拟机 Redhat 环境

Linux 系统安装 Docker

本地虚拟机 Redhat 9.0系统

复制代码
# 编辑 docker源
cd /etc/yum.repos.d/
vim docker-ce.repo
# 输入下面信息
[docker]
 name=docker
 baseurl=https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/rhel/9/x86_64/stable/
 gpgcheck=0 
dnf makecache

# 安装docker
dnf search docker
dnf install docker-ce.x86_64
  
# 卸载 podman 冲突
rpm -qa |grep podman
rpm -e podman-docker-4.2.0-3.el9.noarch --nodeps
rpm -qa |grep runc
rpm -e runc-1.1.4-1.el9.x86_64 --nodeps

启动:
systemctl enable --now docker
systemctl start docker

# 运行docker
[root@AI docker]# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
e6590344b1a5: Pull complete
Digest: sha256:940c619fbd418f9b2b1b63e25d8861f9cc1b46e3fc8b018ccfe8b78f19b8cc4f
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

安装中遇到的问题:

问题1:

root@AI yum.repos.d# docker pull hello-world

Using default tag: latest

Cannot connect to the Docker daemon at unix:///run/podman/podman.sock. Is the docker daemon running?

添加权限, 然后 reboot

sudo usermod -aG docker ${USER}

问题2:

docker pull hello-world

Using default tag: latest

Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

vim /etc/docker/daemon.json

添加下面信息

{

"registry-mirrors" : [

"https://docker.nju.edu.cn",

"https://docker.mirrors.sjtug.sjtu.edu.cn"

],

"insecure-registries" : [

"docker.mirrors.ustc.edu.cn"

],

"debug": true,

"experimental": false

}

重启服务

sudo systemctl restart docker

搭建RAGFlow 环境:

复制代码
# 克隆代码库
git clone https://github.com/infiniflow/ragflow.git

# 修改.env文件, 使用完整版
# 第84行:# RAGFLOW_IMAGE=infiniflow/ragflow:v0.16.0-slim
# 第87行:RAGFLOW_IMAGE=infiniflow/ragflow:v0.16.0

cd ragflow/docker
# 启动服务
docker compose -f docker-compose.yml up -d

# 查看运行状态
docker logs -f ragflow-server

遇到的问题:

安装成功效果展示

运行完成:

查看运行日志:

访问目标环境地址:

注册登录即可

登录页面选择 ollama 模型

选择 chat 类型,模型名称输入已部署 ollama名称及地址

查看另一台环境部署的 ollama:

复制代码
# 查看模型名称
ollama list
NAME                 ID              SIZE      MODIFIED
deepseek8b:latest    07c360b6bd34    4.9 GB    18 hours ago

# 容许访问,以windows 为例
window:  [Environment]::SetEnvironmentVariable("OLLAMA_HOST", "0.0.0.0", "Machine")
关闭防火墙端口 New-NetFirewallRule -DisplayName "Ollama API" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 11434

(确认后运行时间稍长,需要等待 10分钟... )

Embedding 模型用于知识库的向量转换

创建知识库

编写配置.

上传测试知识库文件,本地上传的华为交换机命令文档

效果展示:

创建聊天:

运行结果确认:

PS: 关联不太大,确实有点智障,当然可能和配置的大模型有关系,后续继续学习吧

相关推荐
元Y亨H15 小时前
大模型技术 Ollama 概述
llm·ollama
liwulin050610 天前
【ollama】自定义结构化输出
linux·前端·数据库·ollama
做个文艺程序员10 天前
Linux第27篇:在Linux服务器部署本地大模型:Ollama+开源LLM实战
linux·服务器·开源·大模型·ollama
寒水馨10 天前
Windows下载、安装ollama-v0.32.1(附安装包OllamaSetup.exe)
windows·llm·大语言模型·llama·本地部署·ollama·模型运行
gerrywhu10 天前
【产品研发】基于本地OCR大模型文书自动生成软件开发
ollama·本地部署大模型·离线部署·ocr大模型·paddleocr-vl·glm-ocr·文档自动生成
skywalk816311 天前
用ollama启动duan-translator 小模型
服务器·ollama·段言
行者-全栈开发14 天前
【码动四季】Spring AI + RAG 电商知识库:AtomCode 如何让 Embedding 对齐从 3 天缩短到 4 小时
embedding·向量检索·ollama·spring ai·pgvector·atomcode·rag电商知识库
weipt15 天前
用Ollama开发聊天程序实战
python·ollama
天狼啸月199017 天前
RagSEDE复现: Docker and Ragflow 关系
docker·容器·ragflow·ragsede
闲猫18 天前
Ollama 本地部署,Python、SpringAI对接Ollama
人工智能·python·ollama·spring ai