Skip to main content

Ubuntu mirror synchronisation with global deduplication

Project description

Ubuntu/Debian mirror synchronisation with intelligent deduplication using hardlinks.

Features

  • Downloads from upstream and hardlinks duplicate files (same SHA256 hash) to save bandwidth and disk space
  • Supports multiple mirrors with global deduplication across all mirrors
  • Uses curl for duplicate files, rsync for unique files and metadata
  • Configurable via YAML files
  • Systemd timer support for automated synchronisation

Installation

Option 1: Debian/Ubuntu Package (Recommended)

Download the latest .deb package from GitHub Releases:

wget https://github.com/munger/mirror-dedupe/releases/download/v0.2.0/mirror-dedupe_0.2.0-1_all.deb
sudo dpkg -i mirror-dedupe_0.2.0-1_all.deb

This includes systemd integration, man pages, and proper package management.

Option 2: PyPI (All Linux Distributions)

pip install mirror-dedupe

Then install systemd files manually:

sudo ./install.sh --pip

Option 3: From Source

git clone https://github.com/munger/mirror-dedupe.git
cd mirror-dedupe
sudo ./install.sh

Configuration

Configuration files are located in /etc/mirror-dedupe/:

  • mirror-dedupe.conf - Global settings
  • repos-available/ - Available repository configurations
  • repos-enabled/ - Enabled repositories (symlinks to repos-available)

Adding a Repository

Use the scanner to auto-generate configuration for a repository, for example:

mirror-dedupe-scan --name grafana --dest grafana https://apt.grafana.com

See config/repos-available/README.md for the full mirror-dedupe-scan reference and ready-made commands for all of the packaged example repositories.

Then test and enable it using the CLI:

# Test that the upstream and GPG key URL (if configured) are reachable
mirror-dedupe --test grafana

# If the test looks good, activate the repository
mirror-dedupe --activate grafana

If you prefer, you can still enable it manually with a symlink:

cd /etc/mirror-dedupe/repos-enabled
ln -s ../repos-available/grafana.conf .

Advanced: Alternative config directories

By default, both tools use /etc/mirror-dedupe. You can override this with --config, e.g. for testing or multiple instances:

mirror-dedupe --config /tmp/mirror-test --test grafana

Pre-configured Repositories

The package includes pre-configured repositories:

  • ubuntu - Ubuntu main archive (noble)
  • ubuntu-ports - Ubuntu ports archive (noble)
  • ubuntu-cloud - Ubuntu Cloud Archive (selected OpenStack tracks on noble)
  • debian - Debian stable archive (bookworm)
  • docker - Docker packages for Ubuntu noble
  • grafana - Grafana APT repository
  • influxdb - InfluxData repository for Debian/Ubuntu
  • kubernetes - Kubernetes packages from apt.kubernetes.io
  • nginx - Official NGINX packages for Ubuntu
  • nodesource-node22 - Node.js 22.x LTS from NodeSource
  • postgresql - PostgreSQL APT repository (noble-pgdg)

Usage

# Sync all mirrors
mirror-dedupe

# Sync specific mirror
mirror-dedupe --mirror ubuntu

# Dry run
mirror-dedupe --dry-run

# Dedupe only (no sync)
mirror-dedupe --dedupe-only

Systemd Integration

If installed via Debian package, systemd is already configured. Otherwise:

sudo systemctl enable --now mirror-dedupe.timer
sudo systemctl status mirror-dedupe.timer

View logs:

journalctl -u mirror-dedupe.service

Nginx Configuration

See nginx/mirror.conf for an example nginx configuration.

License

MIT License - see LICENSE file for details.

Author

Tim Hosking tim@mungerware.com

https://github.com/munger/mirror-dedupe

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mirror_dedupe-0.2.11.tar.gz (50.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mirror_dedupe-0.2.11-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file mirror_dedupe-0.2.11.tar.gz.

File metadata

  • Download URL: mirror_dedupe-0.2.11.tar.gz
  • Upload date:
  • Size: 50.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mirror_dedupe-0.2.11.tar.gz
Algorithm Hash digest
SHA256 0280505f063a76b791c6bf89f8513d24d6aa431286bef008bab0f46db57e1e69
MD5 6be39ff13e1195ecf2ce5f58343bd434
BLAKE2b-256 454f6f5989c725143ef38f62c3bf04fb0463dff64eedcf213b9cb31cf2bfd295

See more details on using hashes here.

File details

Details for the file mirror_dedupe-0.2.11-py3-none-any.whl.

File metadata

  • Download URL: mirror_dedupe-0.2.11-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mirror_dedupe-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 34c183a67bec65de74a89dd514485d28401725df155c47cf17e71649ad6cfb6e
MD5 78c02e5e6628c4d3941f57331a496cd8
BLAKE2b-256 ab00cf30527fea19f0983737a55652ca42c360ab1a4ad815ca3fb75c2b16079b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page