
Building a Local Private Knowledge Base Q&A System with MaxKB + Ollama
Share
MaxKB is an open-source RAG system focused on knowledge base construction that, when combined with locally deployed Ollama and the DeepSeek R1 7B model, creates a completely offline, highly secure intelligent Q&A platform.
Technical Components:
- Knowledge Base Engine: MaxKB (includes vectorization, retrieval, and Q&A chain)
- Model Service: Ollama (lightweight LLM deployment tool)
- Large Language Model: DeepSeek R1 7B (high-performance Chinese-English bilingual model)
- Deployment Method: Docker containerized deployment, supporting CPU/GPU inference
The powerful capabilities of MaxKB combined with Ollama enable you to quickly build a high-performance, privately deployed knowledge base Q&A system, ensuring enterprise data security while enabling intelligent document retrieval and question answering.
š Project Advantages
Why Choose a Locally Deployed Private Knowledge Base?
Feature | Local Private Deployment | Public Cloud Models |
---|---|---|
Data Security | ā Completely offline, data never leaves local network | ā Risk of sensitive information leakage |
Control | ā Complete control over model parameters/vector database | ā Limited by platform policies |
Response Speed | ā Local inference, low latency | ā Heavily affected by network conditions |
Customization | ā Deep customization of models and UI interface | ā Highly standardized, difficult to customize |
Usage Cost | ā One-time deployment, long-term use | ā ļø Token-based billing, high long-term costs |
Compliance | ā Meets data localization regulatory requirements | ā Potential compliance risks |
The combination of MaxKB + Ollama + DeepSeek provides enterprises with a complete localized RAG (Retrieval-Augmented Generation) solution, especially suitable for scenarios with strict data security and privacy requirements, such as:
- Enterprise internal knowledge base retrieval
- Intelligent Q&A for technical documentation
- Self-service product manual queries
- Customer service knowledge base assistance
š Environment Preparation
System Requirements
- Operating System: Linux (Ubuntu 20.04+), macOS, or Windows 11
- Memory Requirements: Minimum 8GB, 16GB+ recommended
- Storage Space: At least 10GB available space
- GPU: Optional, NVIDIA graphics card with CUDA support can significantly improve performance
Dependencies
š§° Installation Steps
Step 1: Install MaxKB
Clone the project code from the GitHub repository:
git clone https://github.com/1Panel-dev/MaxKB.git
cd MaxKB
Start the MaxKB service using Docker Compose:
docker-compose up -d
Note: If you need custom configuration, you can edit the docker-compose.yml
file
After installation, access the MaxKB management interface at: http://localhost:3000
Step 2: Install Ollama
Ollama is a cross-platform LLM management client (supporting MacOS, Windows, and Linux) that enables seamless deployment of large language models like DeepSeek, Llama, and Mistral. Ollama provides a one-click model deployment solution, ensuring all data is stored locally for complete security and privacy.
Install Ollama in your local environment:
MacOS / Linux:
curl -fsSL https://ollama.com/install.sh | sh
Windows:
- Download the installation package from Ollama's official website
After installation, the Ollama service will run in the background with the default port 11434
Step 3: Pull the DeepSeek R1 7B Model
Pull the DeepSeek R1 7B model from the Ollama library:
ollama pull deepseek:7b
The initial model download requires approximately 4-5GB of space, please ensure your network connection is stable
Verify that the model was successfully installed:
ollama run deepseek:7b
If everything is normal, you will see a prompt indicating that the model has loaded and is ready for use.
Step 4: Configure MaxKB to Use the Local Ollama Model
- Log in to the MaxKB admin panel
- Go to the "Model Settings" page
- Click "Add Model"
- Select Ollama:
- Name: Ollama-DeepSeek
- Type: Custom Model (OpenAI compatible)
- Inference Address:
http://localhost:11434
(if MaxKB and Ollama are on different servers, use the actual IP) - API KEY:
ollama-local
(any value can be entered) - Model:
deepseek:7b
- Click "Test Connection" to confirm model connectivity, then save the configuration
š Usage Guide
Creating a Knowledge Base
- In the MaxKB management interface, click APP
- Click
Create APP
- Enter the application name, description, and select the type as
SIMPLE
- Click
Settings
to configure the application - Configure
AI Model
and select the DeepSeek model you just configured - Click
Parameter Settings
in theRelated Knowledge
section to set retrieval parameters (default values are usually suitable for most scenarios)
Importing Documents
MaxKB supports multiple document import methods:
- File Upload: Supports PDF, Markdown, Word, TXT, and other formats
- Web Scraping: Enter a URL to automatically scrape web content
- API Import: Automate document import via API
After importing, MaxKB automatically performs document chunking and vectorization to complete the knowledge base construction.
Starting Q&A
- Go to the "Q&A Testing" page
- Enter a question, and the system will retrieve relevant document fragments and generate an answer
- You can view the original source of the retrieved information to ensure the reliability of the answer
š” Frequently Asked Questions
Q1: What are the characteristics of the DeepSeek R1 7B model?
A: DeepSeek R1 7B is a high-performance Chinese-English bilingual large model that provides excellent understanding and generation capabilities at the 7B parameter scale. It's suitable for knowledge base Q&A scenarios and can run smoothly on ordinary hardware.
Q2: How can I improve Q&A quality?
A: You can optimize by adjusting the following parameters:
- Increase the number of retrievals (typically 3-5 fragments work best)
- Adjust document chunking size (choose based on document characteristics)
- Optimize prompt templates to guide the model to answer more accurately
Q3: Can it run on servers without a GPU?
A: Absolutely. Ollama supports running DeepSeek R1 7B in CPU mode. Although the response speed will be slower than with a GPU, it's still sufficient for internal enterprise use.
Q4: How can I expand to more knowledge bases?
A: MaxKB supports creating multiple independent knowledge bases, each using different document sets, different retrieval parameters, and even different models to meet the requirements of multiple business scenarios.
Q5: How can I ensure deployment security?
A: The following measures are recommended:
- Deploy on an internal network, limiting external access
- Enable MaxKB's user authentication features
- Regularly update Ollama and MaxKB to the latest versions
- After the initial model download, consider running in a disconnected production environment
ā Conclusion
MaxKB + Ollama + DeepSeek R1 7B provides a complete, secure, and efficient knowledge base solution, allowing enterprises to enjoy advanced AI Q&A capabilities without worrying about data security issues or paying expensive API fees.
For enterprise users who need deeper customization and adaptation to more complex scenarios, MaxKB also provides enterprise-level support services to help you build an intelligent knowledge base system that better meets your business needs.