Skip to content

Instantly share code, notes, and snippets.

@jeffangelion
Created January 14, 2026 07:20
Show Gist options
  • Select an option

  • Save jeffangelion/3327abb7cade3d9203949e07bdae7251 to your computer and use it in GitHub Desktop.

Select an option

Save jeffangelion/3327abb7cade3d9203949e07bdae7251 to your computer and use it in GitHub Desktop.
Mirroring MongoDB Debian repo using debmirror despite its awful structure
#!/usr/bin/env bash
#DIR=path/to/repo/dir
#MongoDB repo structure sucks so we'll download Release, Release.gpg and Packages.gz separately
#MongoDB 8.0 (Debian 12)
#Creating debmirror working directory and placing files by hand (via wget)
mkdir -p ${DIR}/mongodb-8.0/apt/debian/.temp/.tmp/dists/bookworm
wget https://repo.mongodb.org/apt/debian/dists/bookworm/mongodb-org/8.0/Release -O ${DIR}/mongodb-8.0/apt/debian/.temp/.tmp/dists/bookworm/Release
wget https://repo.mongodb.org/apt/debian/dists/bookworm/mongodb-org/8.0/Release.gpg -O ${DIR}/mongodb-8.0/apt/debian/.temp/.tmp/dists/bookworm/Release.gpg
mkdir -p ${DIR}/mongodb-8.0/apt/debian/.temp/dists/bookworm/mongodb-org/8.0/main/binary-amd64/
wget https://repo.mongodb.org/apt/debian/dists/bookworm/mongodb-org/8.0/main/binary-amd64/Packages.gz -O ${DIR}/mongodb-8.0/apt/debian/.temp/dists/bookworm/mongodb-org/8.0/main/binary-amd64/Packages.gz
#Since we can't ignore binary-all download (even if it is not present), we will use amd64 one
mkdir -p ${DIR}/mongodb-8.0/apt/debian/.temp/dists/bookworm/mongodb-org/8.0/main/binary-all/
#You can use cp from ${DIR}/mongodb-8.0/apt/debian/.temp/dists/bookworm/mongodb-org/8.0/main/binary-amd64/Packages.gz but I use wget so duh
wget https://repo.mongodb.org/apt/debian/dists/bookworm/mongodb-org/8.0/main/binary-amd64/Packages.gz -O ${DIR}/mongodb-8.0/apt/debian/.temp/dists/bookworm/mongodb-org/8.0/main/binary-all/Packages.gz
debmirror --ignore-missing-release --diff=none --no-check-gpg --nosource --progress --arch=amd64 --method=http --host='repo.mongodb.org' --root='apt/debian' --dist='bookworm' --section='main' --rsync-extra='none' --skippackages ${DIR}/mongodb-8.0/apt/debian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment