This script automates the process of mirroring all Ubuntu 24.04 (noble) packages using debmirror. It supports full repository syncing across all major sections (main, restricted, universe, multiverse) and optional suites like security, updates, and backports.
- Mirrors Ubuntu 24.04 packages from
archive.ubuntu.com - Downloads all
.debbinaries and metadata files - Supports optional suites:
noble-security,noble-updates,noble-backports - Organizes mirrored content into a local Debian-style repository
- Logs progress, duration, and disk usage
- Handles stale lock files and running processes gracefully
-
Make the script executable:
chmod +x mirror-ubuntu-24.04.sh
-
Run the script:
sudo ./mirror-ubuntu-24.04.sh
-
Follow the interactive prompts to include optional suites.
Make sure the following packages are installed:
-
sudo apt install debmirror
-
rsync(used internally by debmirror)sudo apt install rsync
-
curl,awk,pgrep,tee,du(standard utilities)
Mirroring the full Ubuntu 24.04 repository can consume:
- Base mirror (main only): ~80β100 GB
- Full mirror (all sections + suites): 500β800 GB+
Actual usage depends on selected suites and architecture.
To use the mirrored packages on other machines:
-
Transfer the mirror directory to a server:
rsync -a /Ubuntu-Repository/ user@server:/srv/apt-mirror/
-
Serve it via HTTP (e.g., using Nginx or Apache)
-
Add this to client machines:
echo "deb [trusted=yes] http://your-server/apt-mirror noble main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/offline.list sudo apt update
This script is provided under the MIT License. Feel free to modify and share.