本文概要
Milvus 2.5 Stand-alone 版可通过 Docker 在几分钟内完成安装;只需暴露 19530(gRPC)与 9091(HTTP/WebUI)两个端口,即可让本地电脑通过 PyMilvus 或浏览器访问远程 Linux 服务器上的 Milvus。下面从环境准备、Docker 安装、容器启动、数据持久化、防火墙与安全组配置到客户端连接与常见故障排查,一步到位地给出完整操作指引,并汇总常见陷阱及修复方案。
1 环境准备
1.1 系统与硬件要求
Milvus 2.5 官方推荐 x86-64/ARM64 的 Ubuntu、CentOS、Debian 等 64 位发行版,并至少 2 GB RAM、10 GB 磁盘;生产环境建议 ≥8 GB RAM 及 SSD 存储。
1.2 安装 Docker Engine 及常用插件 环境并配置腾讯云镜像
# 卸载旧版(可选)
sudo apt remove docker docker-engine docker.io containerd runc -y
# 1. 更新本地 apt 索引,确保使用最新的包列表
sudo apt-get update # Refresh the list of available packages and their versions [oai_citation:0‡bbs.fit2cloud.com](https://bbs.fit2cloud.com/t/topic/5896?utm_source=chatgpt.com)
# 2. 安装 HTTPS 传输和下载工具
sudo apt-get install -y ca-certificates curl # 安装 SSL 证书支持(ca-certificates)和网络下载工具(curl) [oai_citation:1‡cloud.tencent.com](https://cloud.tencent.com/developer/article/2439720?utm_source=chatgpt.com)
# 3. 创建存放 GPG 公钥的目录
sudo install -m 0755 -d /etc/apt/keyrings # 创建 /etc/apt/keyrings 目录,并设置权限为 0755(用户可读写执行、组和其他可读执行) [oai_citation:2‡cloud.tencent.com](https://cloud.tencent.com/developer/article/2439720?utm_source=chatgpt.com)
# 4. 从腾讯云镜像下载 Docker 官方 GPG 公钥
sudo curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu/gpg \
-o /etc/apt/keyrings/docker.asc # -f:遇 HTTP 错误时退出;-s:静默模式;-S:显示错误;-L:跟随重定向;将公钥保存到 /etc/apt/keyrings/docker.asc [oai_citation:3‡cloud.tencent.com](https://cloud.tencent.com/developer/article/2297462?utm_source=chatgpt.com)
# 5. 赋予公钥文件可读权限
sudo chmod a+r /etc/apt/keyrings/docker.asc # 让所有用户都可读取此公钥,以便 apt 在执行安装时进行签名验证 [oai_citation:4‡cloud.tencent.com](https://cloud.tencent.com/developer/article/2297462?utm_source=chatgpt.com)
# 6. 添加腾讯云 Docker APT 仓库
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu \
$(. /etc/os-release && echo \"\$VERSION_CODENAME\") stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# - arch=$(dpkg --print-architecture):自动填入系统架构(如 amd64)
# - signed-by:指定使用上述下载的 GPG 公钥验证包签名
# - $(. /etc/os-release && echo "$VERSION_CODENAME"):读取 Ubuntu 发行代