跳到主要内容

📦 安装部署

本文档提供 NextConsole 的完整安装指南,包含 Docker 快速部署和源码部署两种方式。

🐳 Docker 快速部署

环境要求

硬件配置

环境类型CPU内存存储网络
最低配置2核4GB20GB100Mbps
推荐配置4核8GB50GB1Gbps
生产环境8核+16GB+100GB+1Gbps+

系统支持

✅ 完全支持

  • Ubuntu 18.04+ LTS
  • CentOS 7+
  • Debian 10+
  • RHEL 8+

⚠️ 有限支持

  • Windows Server 2019+ (WSL2)
  • macOS 12+ (Docker Desktop)

信创生态支持

NextConsole 支持主流信创环境:

CPU架构

  • ✅ x86_64 (Intel/AMD)
  • ✅ ARM64 (华为鲲鹏、飞腾)
  • ✅ LoongArch (龙芯)
  • ✅ MIPS (龙芯)

操作系统

  • ✅ 统信UOS
  • ✅ 麒麟OS
  • ✅ 中科方德
  • ✅ 红旗Linux

数据库

  • ✅ 达梦数据库
  • ✅ 人大金仓
  • ✅ 神舟通用
  • ✅ PostgreSQL

安装步骤

1. 环境准备

# 安装 Docker 和 Docker Compose
curl -fsSL https://get.docker.com | sh
sudo systemctl enable docker
sudo systemctl start docker

# 安装 Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

2. 获取项目代码

git clone https://github.com/TuringOpsSH/NextConsole.git
cd NextConsole/docker

3. 配置修改

# 编辑 server 配置
vi config/server/config_private.py

# 编辑 admin 配置
vi config/admin/config_private.py

关键配置项(替换为实际值):

# 域名配置(重要!必须修改为实际IP或域名)
app.config["domain"] = "http://您的服务器IP:8080"
app.config["admin_domain"] = "http://您的服务器IP:8082"

# RAG 配置(可选,建议配置)
app.config["EMBEDDING_ENDPOINT"] = "https://api.siliconflow.cn/v1/embeddings"
app.config["EMBEDDING_MODEL"] = "BAAI/bge-m3"
app.config["EMBEDDING_KEY"] = "您的-SiliconFlow-API-KEY"

app.config["RERANK_ENDPOINT"] = "https://api.siliconflow.cn/v1/rerank"
app.config["RERANK_MODEL"] = "BAAI/bge-reranker-v2-m3"
app.config["RERANK_KEY"] = "您的-SiliconFlow-API-KEY"

app.config["search_engine_endpoint"] = "https://google.serper.dev/search"
app.config["search_engine_key"] = "您的-Serper-API-KEY"

4. 启动服务

# 启动所有服务
docker compose up -d

# 查看启动状态
docker compose ps

# 查看日志
docker compose logs -f

5. 验证安装

访问地址

默认登录信息

  • 用户名: admin@nextconsole.cn
  • 密码: next_console

🛠️ 源码部署

前置依赖

系统要求

由于某些依赖限制,目前仅支持在以下系统进行源码部署:

  • ✅ Windows 10/11 (WSL2 推荐)
  • ✅ macOS 12+
  • ✅ Ubuntu 18.04+

必要组件

  1. Web服务器: Nginx (用于反向代理和静态资源服务)
  2. 数据库: PostgreSQL 12+ (数据存储)
  3. 缓存: Redis 6+ (缓存和任务队列管理)

环境准备

1. 安装 PostgreSQL

# Ubuntu/Debian
sudo apt update
sudo apt install postgresql postgresql-contrib

# 初始化数据库
sudo -u postgres psql -f docker/config/db/init.sql

2. 安装 Redis

# Ubuntu/Debian
sudo apt install redis-server
sudo systemctl enable redis-server
sudo systemctl start redis-server

3. 安装 Nginx

# Ubuntu/Debian
sudo apt install nginx

# 使用提供的配置
sudo cp docker/config/web/nginx.conf /etc/nginx/sites-available/nextconsole
sudo ln -s /etc/nginx/sites-available/nextconsole /etc/nginx/sites-enabled/
sudo systemctl reload nginx

部署步骤

1. 获取源码

git clone https://github.com/TuringOpsSH/NextConsole.git
cd NextConsole

2. 配置后端服务

进入 server 目录

cd server

修改配置文件 app/config/config_private.py

# 基本配置
app.config['domain'] = "http://您的域名或IP"
app.config['data_dir'] = "/app/data"
app.config["download_dir"] = '/app/data/download'

# 数据库配置
app.config["db_type"] = "postgresql"
app.config["db_user"] = "next_console"
app.config["db_password"] = "ncDBPassword" # 修改为实际密码
app.config["db_host"] = "localhost" # 修改为数据库地址
app.config["db_port"] = "5432"
app.config["db_name"] = "next_console"
app.config["db_schema"] = "next_console"

# Redis 配置
app.config['redis_host'] = "localhost" # 修改为Redis地址
app.config['redis_port'] = 6379
app.config['redis_username'] = None
app.config['redis_password'] = 'ncRedisPassword' # 修改为实际密码

# RAG 配置
app.config["EMBEDDING_ENDPOINT"] = "https://api.siliconflow.cn/v1/embeddings"
app.config["EMBEDDING_MODEL"] = "BAAI/bge-m3"
app.config["EMBEDDING_KEY"] = "您的-SiliconFlow-API-KEY"

app.config["RERANK_ENDPOINT"] = "https://api.siliconflow.cn/v1/rerank"
app.config["RERANK_MODEL"] = "BAAI/bge-reranker-v2-m3"
app.config["RERANK_KEY"] = "您的-SiliconFlow-API-KEY"

app.config["search_engine_endpoint"] = "https://google.serper.dev/search"
app.config["search_engine_key"] = "您的-Serper-API-KEY"

3. 启动服务

# 安装依赖
pip install -r requirements.txt

# 启动服务(使用私有配置)
bash start.sh -m private

4. 配置管理后台

进入 admin 目录

cd ../admin

执行同样的配置修改和启动步骤

  1. 修改 app/config/config_private.py 中的配置项
  2. 安装依赖: pip install -r requirements.txt
  3. 启动服务: bash start.sh -m private

验证部署

检查服务状态

# 检查 server 服务
curl http://localhost:8080/api/health

# 检查 admin 服务
curl http://localhost:8082/api/health

# 检查数据库连接
psql -h localhost -U next_console -d next_console -c "SELECT version();"

# 检查 Redis 连接
redis-cli ping

访问服务

故障排查

常见问题

  1. 端口冲突:修改配置中的端口号
  2. 数据库连接失败:检查 PostgreSQL 服务状态和连接参数
  3. Redis 连接失败:检查 Redis 服务状态和认证配置
  4. 依赖安装失败:使用虚拟环境或检查网络连接

获取帮助

如果遇到问题,请:

  1. 查看日志文件:logs/app.log
  2. 检查服务状态:systemctl status postgresqlsystemctl status redis-server
  3. GitHub Issues 提交问题

📊 部署方式对比

特性Docker 部署源码部署
部署难度⭐☆☆☆☆ (简单)⭐⭐⭐☆☆ (中等)
部署时间10-15分钟30-60分钟
维护成本
定制灵活性
生产推荐✅ 推荐⚠️ 需要运维经验

🎯 下一步

完成安装后,建议:

  1. 📖 阅读快速开始指南
  2. ⚙️ 进行系统配置
  3. 🤖 体验核心功能

如有任何安装问题,请查阅 常见问题解答