https://github.com/behnam0x/debian-mirror-sync
Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.
https://github.com/behnam0x/debian-mirror-sync
automation bash bookworm bullseye buster debian debmirror forky linux mirrored-repository offline-repos sid stretch trixie
Last synced: about 1 month ago
JSON representation
Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.
- Host: GitHub
- URL: https://github.com/behnam0x/debian-mirror-sync
- Owner: behnam0x
- License: mit
- Created: 2025-10-15T10:40:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-29T08:34:04.000Z (8 months ago)
- Last Synced: 2025-11-01T21:04:31.620Z (7 months ago)
- Topics: automation, bash, bookworm, bullseye, buster, debian, debmirror, forky, linux, mirrored-repository, offline-repos, sid, stretch, trixie
- Language: Shell
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Debian Mirror Sync Script
A powerful and interactive Bash script for syncing Debian repositories using `debmirror`. It supports multiple distributions, optional suites, section filtering, custom mirrors, and robust lockfile handling โ all with detailed logging and colorful terminal output.
---
## ๐ Features
- Interactive or automated modes:
- `--all`: sync all supported distros
- `--manual`: specify a custom mirror URL and codename
- Supports syncing:
- Base distributions: `stretch`, `buster`, `bullseye`, `bookworm`, `trixie`, `forky`, `sid`
- Optional suites: `-security`, `-updates`, `-backports`
- Section filtering:
- Choose from `main`, `main,contrib`, or `main,contrib,non-free`
- Custom mirror URL support for alternative sources
- Lockfile detection and cleanup to prevent conflicts
- Excludes large desktop environments and multimedia packages to save space
- Logs activity to `/var/log/debmirror-update.log`
- Color-coded terminal output for better readability
---
## ๐ฆ Requirements
Ensure the following dependencies are installed:
- **Bash** (tested on Debian-based systems)
- **debmirror**
```bash
sudo apt install debmirror
```
- Standard utilities:
- `rsync`, `curl`, `awk`, `pgrep`, `tee`, `du`
---
## ๐งช Usage
Make the script executable:
```bash
chmod +x debian-mirror-sync.sh
```
Run interactively:
```bash
sudo ./debian-mirror-sync.sh
```
Or use automation flags:
```bash
sudo ./debian-mirror-sync.sh --all
sudo ./debian-mirror-sync.sh --manual
```
Follow the prompts to select distros, suites, and sections.
---
## ๐พ Disk Space Requirements
Estimated disk usage:
- **Single distro (main only)**: ~50โ80 GB
- **Full mirror (all distros + suites + sections)**: **500โ1000 GB+**
Actual usage depends on selections and exclusions.
---
## ๐ Serving the Mirror
To use the mirrored packages on other machines:
1. Transfer the mirror directory to a server:
```bash
rsync -a /Debian-Repository/ user@server:/srv/apt-mirror/
```
2. Serve it via HTTP (e.g., using Nginx or Apache)
3. Add this to client machines:
```bash
echo "deb [trusted=yes] http://your-server/apt-mirror bullseye main contrib non-free" | sudo tee /etc/apt/sources.list.d/offline.list
sudo apt update
```
---
## ๐ License
This project is licensed under the [MIT License](LICENSE). Feel free to modify and share.