惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

云野开源志

OpenClaw npm 升级踩坑记:从版本冲突到模块丢失 免责声明 openclaw(moltbot、Clawdbot)常见异常 大模型配置-千问免费版 初始化OpenClaw 安装openclaw记录 大年初一桃花谷 CheckSSL.sh - SSL证书到期时间监控脚本 g.sh - Go语言环境管理工具安装脚本 install-cri-docker.sh - cri-dockerd安装脚本 install-docker.sh - Docker Engine快速安装脚本 install-docker2.sh - Docker 交互式安装脚本 install-nginx.sh - Nginx官方源快速安装脚本 install-zerotier.sh - ZeroTier 虚拟网络快速安装脚本 mng.sh - Nginx配置文件合并脚本 OpenSSL.sh - 自签名 SSL 证书生成脚本 SystemInfoMonitor.sh - 系统资源监控告警脚本 UpdateImages.sh - Docker 镜像批量更新脚本 为Hugo Next主题添加Umami统计支持 解忧杂货铺 - 栏目声明 Certd - 解决多平台SSL证书管理难题的神器 轻量级网络端口监控工具 MaxMind 免费账号注册 CloudFlare Accel Docker 搭建私有 DNS 服务器 hugo-theme-stack集成Umami openresty编译添加geoip2模块支持 GPU加速云原生应用,开启高性能计算新纪元 5. K8S Service与Ingress 4. K8S 控制器 Rancher搭建 3. K8S Pod 资源管理 2. K8S 基础资源管理 1. K8S 简介和认证介绍 Rancher集成AzureAD认证 Harbor 部署搭建 站点留言板 关于 友情链接
GeoLite2 自动搬运仓库使用手册
云野开源志 · 2025-10-10 · via 云野开源志

总结摘要

本文详细介绍了如何通过 Fork 开源项目并配置 GitHub Actions,实现 MaxMind GeoLite2 数据库(City/Country/ASN)的自动下载与 Release 发布。用户只需提供 MaxMind 免费 License Key,即可每 3 天自动同步最新 IP 地理数据库,并通过直链或 Git 克隆方式在内网或生产环境中稳定获取 .mmdb 文件,适用于 Nginx、OpenResty 等服务的 geoip2 模块集成。

利用 GitHub Actions 每 3 天自动拉取 MaxMind 官方 GeoLite2-City/Country/ASN 数据库并发布 Release,供内网或生产环境 wget 使用。

前置条件

项目说明
GitHub 账号需能创建公开仓库
MaxMind 账号免费申请,用于获取 license_key(白名单地区建议选 US/JP)注册步骤: MaxMind 免费账号注册
浏览器用于配置仓库密钥

一键 Fork 仓库

  1. 打开 https://github.com/P3TERX/GeoLite.mmdb
  2. 点击右上角 Fork → 选择你的账号 → 完成
  3. 得到自己的仓库地址:
    https://github.com/<你的用户名>/GeoLite.mmdb

配置密钥(Secrets)

路径:Settings → Secrets and variables → Actions → New repository secret

NameValue 获取方式
LICENSE_KEYMaxMind 免费账号注册
GITHUB_TOKEN无需手动创建,Actions 自动注入,留空即可

触发运行

方式操作
手动进入仓库 → Actions → Publish GeoLite.mmdb → Run workflow → Run
自动默认每 3 天 01:00 UTC 自动执行(.ymlcron: 0 1 */3 * *

## 下载最新 .mmdb

单文件直链(推荐)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 城市库
wget -O GeoLite2-City.mmdb \
  https://github.com/<你的用户名>/GeoLite.mmdb/releases/latest/download/GeoLite2-City.mmdb

# 国家库
wget -O GeoLite2-Country.mmdb \
  https://github.com/<你的用户名>/GeoLite.mmdb/releases/latest/download/GeoLite2-Country.mmdb

# ASN 库
wget -O GeoLite2-ASN.mmdb \
  https://github.com/<你的用户名>/GeoLite.mmdb/releases/latest/download/GeoLite2-ASN.mmdb

整库克隆(含全部 .mmdb

1
2
3
git clone -b download --depth 1 https://github.com/<你的用户名>/GeoLite.mmdb.git
cd GeoLite.mmdb
ls *.mmdb

目录结构(download 分支)

1
2
3
GeoLite2-City.mmdb
GeoLite2-Country.mmdb
GeoLite2-ASN.mmdb

常见问题

现象原因解决
Actions 日志 ERROR 451账号地区被限制换新账号(地区选 US/JP)或改用镜像
Release 页面无文件密钥未填或填错检查 LICENSE_KEY 是否正确
旧 Release 堆积正常脚本自动保留最近 2 个,其余会删除

更新历史查看

进入仓库 → Releases → 标签即为打包日期(例 2025.10.10

一键更新脚本(可放服务器 crontab)

1
2
3
4
5
6
7
8
9
#!/bin/bash
DIR=/opt/geoip2
mkdir -p $DIR
for DB in City Country ASN; do
  wget -q -O $DIR/GeoLite2-${DB}.mmdb \
    https://github.com/<你的用户名>/GeoLite.mmdb/releases/latest/download/GeoLite2-${DB}.mmdb
done
# 重载你的服务
systemctl reload nginx

给执行权限并加入定时任务即可实现自动更新。