Managing Debian and Ubuntu packages across multiple servers requires a reliable, self-hosted package repository. Whether you need to distribute custom-built .deb files, mirror upstream repositories for offline access, or maintain a stable snapshot of package versions for reproducible deployments, a self-hosted apt repository gives you full control over your software supply chain.
In this guide, we compare three established tools for managing Debian package repositories: Aptly, Reprepro, and Apt-mirror. Each serves a different use case — from full-featured repository publishing to simple upstream mirroring.
Why Self-Host a Package Repository?
Organizations running Debian or Ubuntu systems benefit from a local package repository for several reasons:
- Bandwidth savings — download packages once from upstream, serve locally to hundreds of servers
- Air-gapped deployments — maintain package access for systems without internet connectivity
- Version pinning — freeze package versions for compliance and reproducibility requirements
- Custom packages — distribute internally-built
.debpackages alongside upstream software - Security — verify and sign packages before distribution, controlling exactly what reaches your servers
- Snapshot capability — roll back to a known-good repository state after a bad update
For teams managing infrastructure at scale, a local repository is not a luxury — it’s a necessity. The question is which tool best fits your workflow.
Quick Comparison Table
| Feature | Aptly | Reprepro | Apt-mirror |
|---|---|---|---|
| Type | Full repository manager | Repository publisher | Upstream mirror |
| Language | Go | C | Perl |
| Web UI | No (REST API) | No | No |
| Custom packages | Yes | Yes | No (mirror only) |
| Snapshot support | Yes (point-in-time) | No | No |
| Mirror upstream | Yes | Partial | Yes (primary use case) |
| GPG signing | Yes | Yes | No |
| Docker image | Official | Community | Community |
| Best For | Full lifecycle management | Simple publishing | Bandwidth-saving mirrors |
Aptly — Full Repository Lifecycle Management
Aptly is the most feature-complete Debian repository manager available. Written in Go, it handles the entire package repository lifecycle: mirroring upstream repos, importing custom packages, creating snapshots, and publishing signed repositories.
Key Features
- Snapshot management — create point-in-time snapshots of any repository state and publish them independently
- Flexible filtering — create filtered repository views by package name, version, architecture, or dependency constraints
- Multi-architecture support — manage amd64, arm64, armhf, and other architectures from a single repository
- GPG signing — sign published repositories for client verification
- REST API — automate all operations through a JSON API
- S3 and filesystem publishing — publish repositories to local filesystem, Amazon S3, or Swift object storage
- Incremental updates — efficiently sync mirrors by downloading only changed packages
Docker Compose Deployment
| |
Typical Workflow
| |
The snapshot workflow is Aptly’s killer feature. You can publish a snapshot, continue updating mirrors, and switch clients to a new snapshot at your convenience — enabling zero-downtime repository updates and instant rollback capability.
Reprepro — Simple and Reliable Repository Publisher
Reprepro is the traditional Debian repository management tool, written in C and maintained by Debian developers. It focuses on one thing: creating and maintaining apt repository directories from a set of .deb packages.
Key Features
- Battle-tested — used by Debian and Ubuntu infrastructure teams for years
- Simple data model — manages distributions, components, and packages with straightforward commands
- Built-in GPG support — signs Releases files automatically
- Pull-based updates — automatically resolve and include dependencies when adding packages
- Multiple distribution support — manage stable, testing, and unstable branches simultaneously
- Efficient storage — uses hard links to avoid duplicating package files across distributions
Docker Compose Deployment
| |
Configuration and Usage
Reprepro uses a conf/distributions file to define repository structure:
| |
| |
Serve the /repo directory with Nginx:
| |
Reprepro does not mirror upstream repositories — it only manages packages you explicitly add. For mirroring, pair it with Apt-mirror or use Aptly instead.
Apt-mirror — Upstream Repository Mirroring
Apt-mirror is a specialized tool for creating exact local copies of upstream Debian and Ubuntu repositories. It downloads all packages, metadata, and indexes from the source repository, making them available locally.
Key Features
- Exact mirroring — creates a byte-for-byte local copy of upstream repositories
- Incremental sync — only downloads new or changed packages on subsequent runs
- Multiple architectures — mirror packages for different CPU architectures
- Multiple releases — mirror multiple Debian/Ubuntu versions simultaneously
- Automated via cron — designed to run on a schedule for continuous synchronization
- Low overhead — uses rsync-like efficiency for incremental updates
Docker Compose Deployment
| |
Configuration
Configure /etc/apt/mirror.list:
| |
Run the mirror:
| |
Apt-mirror creates a directory structure that can be served directly via HTTP:
| |
Clients then point to http://mirror.internal/debian or http://mirror.internal/archive.ubuntu.com/ubuntu in their /etc/apt/sources.list.
Performance and Storage Comparison
| Metric | Aptly | Reprepro | Apt-mirror |
|---|---|---|---|
| Initial mirror (full Debian stable) | ~50 GB | N/A (no mirroring) | ~50 GB |
| Storage efficiency | Good (dedup via snapshots) | Excellent (hard links) | Fair (full mirror) |
| Sync speed (incremental) | Fast (API-driven) | N/A | Fast (rsync-based) |
| Memory usage | ~200 MB | ~50 MB | ~100 MB |
| Setup complexity | Moderate | Low | Low |
| Maintenance effort | Low | Low | Low |
For pure mirroring, Apt-mirror and Aptly are comparable in storage requirements. Aptly’s snapshot feature adds ~10-20% overhead per snapshot but provides rollback capability that the other tools lack.
Combining Tools in Production
In real-world deployments, organizations often combine these tools:
- Apt-mirror syncs upstream repositories to a local mirror for bandwidth savings
- Aptly imports the mirrored packages, adds custom
.debfiles, and creates snapshots - Reprepro publishes the final repository to internal servers (optional, if you prefer its simpler model)
A common pattern is to use Aptly for everything — it mirrors, manages custom packages, snapshots, and publishes in a single tool. This reduces operational complexity compared to maintaining multiple tools.
Why Self-Host Your Package Repository?
Running your own package repository is foundational infrastructure for any organization using Debian or Ubuntu at scale. It eliminates dependency on external mirrors that can be slow, unreliable, or blocked by network policies. For compliance-driven environments, it provides an auditable, version-controlled software supply chain.
A local repository pairs naturally with other self-hosted infrastructure tools. If you manage binary artifacts beyond Debian packages, our binary repository comparison covers Nexus, Artifactory OSS, and Pulp. For Python-specific needs, our PyPI mirror guide covers self-hosted Python package management. And for broader package ecosystem coverage, our general package registry guide includes npm, Maven, and Docker registries.
FAQ
What is the difference between Aptly, Reprepro, and Apt-mirror?
Aptly is a full repository lifecycle manager that mirrors, manages custom packages, creates snapshots, and publishes repositories. Reprepro is a repository publisher that creates apt repository directories from packages you explicitly add — it does not mirror upstream repos. Apt-mirror is a dedicated upstream mirroring tool that creates local copies of Debian/Ubuntu repositories but cannot manage custom packages.
Can I use these tools with Ubuntu repositories?
Yes. All three tools support Ubuntu repositories alongside Debian. Configure the appropriate Ubuntu mirror URLs (archive.ubuntu.com or security.ubuntu.com) and the tools handle the repository format identically.
How much storage do I need for a full Debian mirror?
A full Debian stable mirror with main, contrib, and non-free components for amd64 requires approximately 50-60 GB. Adding arm64 and other architectures increases this proportionally. Using Apt-mirror’s clean feature removes obsolete packages automatically.
Can Aptly replace both Reprepro and Apt-mirror?
Yes. Aptly can mirror upstream repositories (replacing Apt-mirror) and publish custom package repositories (replacing Reprepro). Its snapshot feature adds capabilities neither of the other tools provides.
How do I serve the repository to client machines?
Serve the published directory via any HTTP server (Nginx, Apache, Caddy). Clients add the repository to /etc/apt/sources.list pointing to your server URL. For HTTPS, place a reverse proxy with TLS termination in front of the HTTP server.
Is GPG signing required?
GPG signing is not strictly required but strongly recommended. Clients can be configured to accept unsigned repositories, but signing provides verification that packages haven’t been tampered with during transit or storage.
How often should I update my mirror?
For security updates, daily synchronization is recommended. For full repository mirrors, weekly updates are sufficient. Configure a cron job to run apt-mirror or aptly mirror update on your preferred schedule.
Can I mirror only specific packages, not the entire repository?
Aptly supports filtering during mirror creation (by priority, section, architecture, or package name). Apt-mirror mirrors entire suites — you cannot filter individual packages. Reprepro only manages packages you explicitly add, so it is inherently filtered.