Create Your Own Debian 7 (wheezy) Mirror
To setup a debian mirror, please refer to my tutorial on setting up an ubuntu mirror, but change the contents of the /etc/apt/mirror.list
file to contan the following:
...
############# end config ##############
# copy below this line
# debian mirror
deb-amd64 http://ftp.uk.debian.org/debian wheezy main contrib non-free
deb-amd64 http://ftp.uk.debian.org/debian wheezy-backports main contrib non-free
deb-amd64 http://ftp.uk.debian.org/debian wheezy-updates main contrib non-free
deb-amd64 http://ftp.uk.debian.org/debian wheezy-proposed-updates main contrib non-free
deb-i386 http://ftp.uk.debian.org/debian wheezy main contrib non-free
deb-i386 http://ftp.uk.debian.org/debian wheezy-backports main contrib non-free
deb-i386 http://ftp.uk.debian.org/debian wheezy-updates main contrib non-free
deb-i386 http://ftp.uk.debian.org/debian wheezy-proposed-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.uk.debian.org/debian wheezy-backports main contrib non-free
deb-src http://ftp.uk.debian.org/debian wheezy-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian wheezy-proposed-updates main contrib non-free
clean http://ftp.uk.debian.org/debian
i18n
Unfortunately, this won't sync the translation files within the i18n directories, so we need to create a script with the following contents that will do this for us after apt-mirror has finished.
sudo apt-mirror
cd /var/spool/apt-mirror/mirror/ftp.uk.debian.org/debian/dists/wheezy
for master_directory in wheezy wheezy-updates wheezy-backports; do
cd $master_directory
for directory in contrib main non-free; do
cd $directory
mkdir i18n 2>/dev/null
cd i18n
rm Translation-en*
wget http://ftp.uk.debian.org/debian/dists/$master_directory/$directory/i18n/Translation-en.bz2
cd ../../
done
cd ..
done
Now just configure a cron job to call that script every day.
Example Sources File
To use your local mirror simply replace the file at /etc/apt/sources.list
with the following contents (replacing my.domain.com
)
deb http://my.domain.com/debian/ wheezy main
deb-src http://my.domain.com/debian/ wheezy main
deb http://my.domain.com/debian/ wheezy-updates main
deb-src http://my.domain.com/debian/ wheezy-updates main
# security updates
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
#deb http://my.domain.com/debian/ wheezy-backports main
#deb-src http://my.domain.com/debian wheezy-backports main
Feel free to uncomment the backports line at your own risk after reading about what they are.
References
Last updated: 17th April 2021
First published: 16th August 2018
First published: 16th August 2018