-
-
Save husjon/99d38cf07b17304dfcd0b2436a09954f to your computer and use it in GitHub Desktop.
Creating a Debian Repository with apt-mirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's very handy to have a local mirror of the Debian stable repository, especially if you want to do fast network installs and updates for multiple systems. By default, the Debian utility apt-mirror does a great job of pulling over packages, but to be able to use PXE netbooting and other cool tricks you need to do a few tweaks to its basic configuration. | |
#### START /etc/apt/mirror.list #### | |
set base_path /var/spool/apt-mirror | |
set mirror_path $base_path/mirror | |
set skel_path $base_path/skel | |
set var_path $base_path/var | |
set cleanscript $var_path/clean.sh | |
set _autoclean 1 | |
set postmirror_script $var_path/postmirror.sh | |
set run_postmirror 1 | |
#set nthreads 20 | |
set nthreads 10 | |
set limit_rate 100k | |
set _tilde 0 | |
deb-i386 http://ftp.us.debian.org/debian wheezy main/debian-installer main contrib non-free | |
deb-i386 http://ftp.us.debian.org/debian wheezy-updates main/debian-installer main contrib non-free | |
deb-i386 http://ftp.us.debian.org/debian wheezy-backports main/debian-installer main contrib non-free | |
deb-i386 http://security.debian.org/debian-security wheezy/updates main contrib non-free | |
deb-i386 http://www.deb-multimedia.org wheezy main non-free | |
deb-amd64 http://ftp.us.debian.org/debian wheezy main/debian-installer main contrib non-free | |
deb-amd64 http://ftp.us.debian.org/debian wheezy-updates main/debian-installer main contrib non-free | |
deb-amd64 http://ftp.us.debian.org/debian wheezy-backports main/debian-installer main contrib non-free | |
deb-amd64 http://security.debian.org/debian-security wheezy/updates main contrib non-free | |
deb-amd64 http://www.deb-multimedia.org wheezy main non-free | |
deb-src http://ftp.us.debian.org/debian wheezy main contrib non-free | |
deb-src http://ftp.us.debian.org/debian wheezy-updates main contrib non-free | |
deb-src http://ftp.us.debian.org/debian wheezy-backports main contrib non-free | |
deb-src http://security.debian.org/debian-security wheezy/updates main contrib non-free | |
deb-src http://www.deb-multimedia.org wheezy main non-free | |
skip-clean http://ftp.us.debian.org/debian/dists/wheezy/main/installer-amd64 | |
skip-clean http://ftp.us.debian.org/debian/dists/wheezy/main/installer-i386 | |
skip-clean http://ftp.us.debian.org/debian/dists/wheezy-proposed-updates/main/installer-amd64 | |
skip-clean http://ftp.us.debian.org/debian/dists/wheezy-proposed-updates/main/installer-i386 | |
clean http://ftp.us.debian.org/debian | |
clean http://security.debian.org/debian-security | |
clean http://deb-multimedia.org/ | |
#### End #### | |
#### START /var/spool/apt-mirror/var/postmirror.sh #### | |
#!/bin/bash | |
SRC_BASE="rsync://mirrors.usc.edu/debian/dists" | |
DEST_BASE="/var/spool/apt-mirror/mirror/ftp.us.debian.org/debian/dists" | |
repo="wheezy wheezy-proposed-updates" | |
arch="amd64 i386" | |
for _repo in ${repo}; do | |
for _arch in ${arch}; do | |
/usr/bin/rsync --archive --verbose --compress --delete ${SRC_BASE}/${_repo}/main/installer-${_arch}/ ${DEST_BASE}/${_repo}/main/installer-${_arch} | |
done | |
done | |
repo="wheezy wheezy-backports wheezy-proposed-updates wheezy-updates" | |
section="contrib main non-free" | |
for _repo in ${repo}; do | |
for _section in ${section}; do | |
if [ -d ${DEST_BASE}/${_repo}/${_section} ]; then | |
cd ${DEST_BASE}/${_repo}/${_section} | |
if [ ! -d i18n ]; then | |
mkdir i18n | |
fi | |
cd i18n | |
rm -rf Translation-en* | |
wget -q http://ftp.us.debian.org/debian/dists/${_repo}/${_section}/i18n/Translation-en.bz2 | |
cd ../../ | |
fi | |
done | |
done | |
# End | |
#### END /var/spool/apt/var/postmirror.sh #### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment