前提條件
- Ubuntu 服務器(20.04 或 22.04 LTS 推薦)
- 已安裝 Docker 和 Docker Compose
- 如果尚未安裝,請先運行以下命令:
# 安裝 Docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # 將當前用戶加入 docker 組,避免每次都要 sudo sudo usermod -aG docker $USER newgrp docker # 刷新組權限,或重新登錄服務器生效# 安裝 Docker Compose 插件 sudo apt-get update sudo apt-get install docker-compose-plugin # 驗證安裝 docker compose version
- 如果尚未安裝,請先運行以下命令:
- 確保服務器端口
80
和8010
未被其他程序占用。RAGFlow 默認使用這些端口。
安裝步驟
第 1 步:下載部署文件
首先,創建一個項目目錄并進入,然后從 GitHub 拉取 RAGFlow 的 Docker Compose 配置文件。
# 創建并進入一個目錄,例如 ragflow
mkdir ragflow && cd ragflow# 從 GitHub 拉取 RAGFlow 的 Docker Compose 配置文件
git clone https://github.com/infiniflow/ragflow.git
第 2 步:修改RAGFlow配置
RAGFlow依賴組件包括Mysql、Redis、MinIO、Nginx等,因為我的服務之前已安裝過這些組件,防止端口沖突,影響RAGFlow啟動。
- 修改docker-compose.yml中nginx的端口從80修改成8580,443修改成8443
注意:原則不在配置這個 docker-compose.yml直接修改端口號,正確的做法應該是修改環境變量
include:- ./docker-compose-base.yml
# To ensure that the container processes the locally modified `service_conf.yaml.template` instead of the one included in its image, you need to mount the local `service_conf.yaml.template` to the container.
services:ragflow:depends_on:mysql:condition: service_healthyimage: ${RAGFLOW_IMAGE}# Example configuration to set up an MCP server:# command:# - --enable-mcpserver# - --mcp-host=0.0.0.0# - --mcp-port=9382# - --mcp-base-url=http://127.0.0.1:9380# - --mcp-script-path=/ragflow/mcp/server/server.py# - --mcp-mode=self-host# - --mcp-host-api-key=ragflow-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx# Optional transport flags for MCP (customize if needed).# Host mode need to combined with --no-transport-streamable-http-enabled flag, namely, host+streamable-http is not supported yet.# The following are enabled by default unless explicitly disabled with --no-<flag>.# - --no-transport-sse-enabled # Disable legacy SSE endpoints (/sse and /messages/)# - --no-transport-streamable-http-enabled # Disable Streamable HTTP transport (/mcp endpoint)# - --no-json-response # Disable JSON response mode in Streamable HTTP transport (instead of SSE over HTTP)container_name: ragflow-serverports:- ${SVR_HTTP_PORT}:9380- 8580:80 #修改1- 8443:443 #修改2- 5678:5678 - 5679:5679- 9382:9382 # entry for MCP (host_port:docker_port). The docker_port must match the value you set for `mcp-port` above.volumes:- ./ragflow-logs:/ragflow/logs- ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf- ./nginx/proxy.conf:/etc/nginx/proxy.conf- ./nginx/nginx.conf:/etc/nginx/nginx.conf- ../history_data_agent:/ragflow/history_data_agent- ./service_conf.yaml.template:/ragflow/conf/service_conf.yaml.template- ./entrypoint.sh:/ragflow/entrypoint.shenv_file: .envenvironment:- TZ=${TIMEZONE}- HF_ENDPOINT=$