借鑒視頻: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=dockerbaseurl=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.0cd 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:?關聯不太大,確實有點智障,當然可能和配置的大模型有關系,后續繼續學習吧