Skip to content

Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.

License

Notifications You must be signed in to change notification settings

behnam0x/debian-mirror-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŒ€ 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
    sudo apt install debmirror
  • Standard utilities:
    • rsync, curl, awk, pgrep, tee, du

πŸ§ͺ Usage

Make the script executable:

chmod +x debian-mirror-sync.sh

Run interactively:

sudo ./debian-mirror-sync.sh

Or use automation flags:

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:

    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:

    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. Feel free to modify and share.

About

Bash script for interactive and customizable Debian mirror synchronization using debmirror. Supports multiple distros, suites, and section filtering with lockfile handling and logging.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages