RAGFlow Deployment Tutorial
RAGFlow's pitch is turnkey deployment, strong Chinese document parsing and a visual interface. Docker setup, the one kernel parameter you must change, model wiring, chunking strategy, API calls and five pitfalls.
📜 Table of Contents
📖 Keep reading
RAGFlow Deployment Tutorial: An Enterprise Knowledge Base in 10 Minutes
Anyone who assembled RAG by hand knows the drill: tune chunking, tune retrieval, write your own UI, watch tables turn to mush. RAGFlow packages the whole thing into a service with a visual interface, so non-technical colleagues can upload documents and build a knowledge base.
It is a system, not a library. It costs resources and saves weeks.
1. Check the machine first
| Item | Recommended | Note |
|---|---|---|
| CPU | 4+ cores | parsing is CPU heavy |
| RAM | 16GB minimum | Elasticsearch struggles below this |
| Disk | 50GB+ free | images, models, documents |
| Docker | installed | compose is the official path |
Check the repository README for exact version requirements.
2. One kernel parameter you must change
Miss this and Elasticsearch restart-loops with vm.max_map_count is too low:
sysctl -w vm.max_map_count=262144
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
On Docker Desktop for Windows, set it inside WSL2.
3. Start it
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/docker
cp .env.example .env
docker compose -f docker-compose.yml up -d
docker compose ps
The first pull takes a while. When es01 and ragflow-server are running, open the service address (port 80 by default, 9380 on older versions — check your compose file) and register the first account, which becomes admin.
4. Wire up three model types
| Type | Used for | Note |
|---|---|---|
| Chat | generating answers | pick a strong Chinese model for Chinese docs |
| Embedding | indexing and retrieval | must be identical for indexing and querying |
| Rerank | reordering hits | enable it if available |
OpenAI-compatible endpoints only need a base_url and key; local Ollama works if you use the host's LAN IP with port 11434, since localhost inside a container means the container. Never change the embedding model after building a knowledge base — the vector spaces differ and retrieval becomes noise.
5. Chunk method decides quality
| Method | For |
|---|---|
| General | manuals, prose |
| Q&A | existing question-answer pairs |
| Paper | academic PDFs, recognises abstract and sections |
| Book | long-form, chapter hierarchy |
| Table | tables — never use General here |
Choosing General for a spec sheet turns parameter tables into scattered numbers. Parsing is asynchronous; nothing is searchable until it finishes.
6. Test retrieval before going live
Use real questions users would ask, not document titles. The test is whether one of the top three hits can answer directly. If not, adjust the similarity threshold, top-k, reranking, and chunk size in that order.
7. Integrate via API
The flow is: create a dataset, upload documents, trigger parsing, create a chat, then ask. Two production notes: parsing is async so poll for status, and streaming responses need chunk reassembly. Endpoint paths and fields are in the official API docs.
8. Five pitfalls
Elasticsearch restarting means too little RAM. Port 80 conflicts should be fixed in the compose mapping, not inside the container. Auth failures are usually a missing /v1 in base_url or whitespace in the key. Garbled Chinese PDFs are scanned or badly embedded fonts — OCR first. Irrelevant retrieval almost always means the wrong chunk method or a swapped embedding model.
FAQ
RAGFlow or Dify? RAGFlow for document-heavy, accuracy-critical retrieval; Dify for workflow orchestration and app building. They coexist well.
Fully offline? Yes, with local models on an intranet machine; only the initial image pull needs internet.
How many documents? Thousands on reasonable hardware. Chunking and embeddings limit quality more than count does.
Editable parse results? Yes, chunks and keywords are viewable and correctable — valuable for contracts and standards.
Enable reranking? For large corpora and specific questions, yes; it usually beats upgrading the generator.
Related
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.