A general chatbot does not know your products, prices, procedures or internal documents, and pasting them into a public AI service is often not acceptable. With retrieval-augmented generation (RAG), the assistant first searches your own documents and answers from what it finds, with citations. This guide sets up AnythingLLM with a local model served by Ollama on your own server: install, connect the language and embedding models, upload documents into workspaces, configure answers that stay within your documents, add users and publish it over HTTPS. For planning a larger deployment (region, vector database, data protection), see building a private AI support knowledge base on a dedicated server.
RAG uses two models: an embedding model that turns document passages and questions into vectors for searching, and a chat model that writes the answer. Both run in Ollama.
ollama pull nomic-embed-text # embedding model (small and fast on CPU)
ollama pull qwen2.5:7b # chat model; good with Chinese and English
ollama list
# AnythingLLM runs in a container, so Ollama must accept connections from Docker
# (OLLAMA_HOST=0.0.0.0 plus the firewall rules from the Ollama guide). Check:
curl -s http://172.17.0.1:11434/api/tags | head -c 300; echo
A server with 8 or more cores and 16 GB of RAM runs this combination comfortably for a small team. Embedding documents uses CPU for a while when you upload many files; answering uses the chat model.
AnythingLLM runs in Docker (see our Docker installation guide).
export STORAGE_LOCATION=/opt/anythingllm
mkdir -p $STORAGE_LOCATION && touch "$STORAGE_LOCATION/.env"
chown -R 1000:1000 $STORAGE_LOCATION # the container runs as user ID 1000
docker run -d --name anythingllm --restart always \
-p 127.0.0.1:3002:3001 \
--cap-add SYS_ADMIN \
--add-host=host.docker.internal:host-gateway \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm
docker logs -f anythingllm # wait until the server reports it is listening
The web interface listens on port 3001 inside the container; it is mapped to 127.0.0.1:3002 on the host so it is only reachable through the HTTPS proxy in Step 3.
Point a subdomain such as kb.example.com to the server, get a certificate (see free SSL with Certbot or acme.sh) and proxy to the container:
server {
listen 443 ssl;
http2 on;
server_name kb.example.com;
ssl_certificate /etc/letsencrypt/live/kb.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kb.example.com/privkey.pem;
client_max_body_size 100m; # document uploads
location / {
proxy_pass http://127.0.0.1:3002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600s;
}
}
Open https://kb.example.com and complete the setup (you can change everything later under Settings):
http://host.docker.internal:11434, chat model qwen2.5:7b.nomic-embed-text (or AnythingLLM's built-in embedder).Before you upload anything, enable multi-user mode in the security settings and set the administrator password. Then create an account for each colleague with the Default role, so they can chat with the workspaces you give them but cannot change settings or see other workspaces.
A workspace is a separate knowledge base with its own documents and settings, for example "Product catalogue", "Support procedures" or "HR policies".
Clean, text-based documents give the best results. Scanned PDFs need OCR first; long documents with clear headings are easier to search than one huge file with everything.
In the workspace settings:
Each answer shows citations; click them to check which document passage was used.
When a document changes, remove the old version from the workspace and upload the new one, so outdated prices or procedures are not quoted. Back up /opt/anythingllm regularly; it contains the documents, vectors, users and chat history. AnythingLLM also offers an API and an embeddable chat widget if you later want to use a workspace from your own website or applications.
Switch the workspace to Query mode, tighten the system prompt, and check the citations. If the right passage is never found, split the document into smaller files with clear titles, or try a larger chat model.
Most of the time is the chat model generating text on CPU. Use a smaller model for quick lookups, reduce the number of passages per answer, and keep the model loaded (see the performance tips in the Ollama guide).
Yes, AnythingLLM supports many providers. Keep in mind that your documents and questions are then sent to that provider, and use only providers and regions that their terms allow. For confidential material, the local setup in this guide keeps everything on your server.
Still stuck after following these steps? Open a support ticket and the IMIDC 24/7 technical team will help. Include the server IP, OS version, CPU and RAM, the output of docker logs anythingllm and the full error message so we can pinpoint the issue faster.