apt-mirror - your local Debian mirror
Having your local Debian mirror can be handy. Especially if you do
install Debian via netboot. Thanks to apt-mirror
it's an easy
task to do.
First of all, you need apt-mirror
:
# apt-get install apt-mirror
Then, you have to edit /etc/apt/mirror.list
and set:
- what
- which mirror to use as a source
- where to store mirrored data or you can use default
/var/spool/apt-mirror/
- adjust number of threads based on power of your hardware
set nthreads 10 set _tilde 0 deb http://debian.ignum.cz/debian/ wheezy main deb http://debian.ignum.cz/debian/ wheezy-updates main deb-amd64 http://debian.ignum.cz/debian/ wheezy main # in case you're going to use your local mirror for preseeding ;;; ugly, but works deb http://debian.ignum.cz/debian/ dists/wheezy/main/debian-installer/binary-amd64
Also, make sure you have enough space available, eg. Wheezy in this configuration takes approximately 41GB.
After you're set, run # apt-mirror ;
. It will take some time and you should see
similar output as shown below. Sadly, my mirror is up-to-date. It will take some time,
so I recommend you to use screen
.
# su apt-mirror -c 'apt-mirror' Downloading 18 index files using 10 threads... Begin time: Sun Jun 23 08:10:58 2013 [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]... End time: Sun Jun 23 08:11:00 2013 Proceed indexes: [PPPP] 0.0 bytes will be downloaded into archive. Downloading 0 archive files using 0 threads... Begin time: Sun Jun 23 08:13:44 2013 [0]... End time: Sun Jun 23 08:13:44 2013 0.0 bytes in 0 files and 0 directories can be freed. Run /var/spool/apt-mirror/var/clean.sh for this purpose. Running the Post Mirror script ... (/var/spool/apt-mirror/var/postmirror.sh) Post Mirror script has completed. See above output for any possible errors.
Congratulations, you have your own local Debian mirror. The very last thing is to keep your local mirror up-to-date automatically. Copy-pasted below is an cron example from documentation which is sufficient.
0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log