this is obsolete doc -- see instead

Setting up a Debian / Ubuntu mirror 


Update: apt-cacher-ng might be a better solution unless you really need a full mirror 



Note. -ng is written in C++ and also has some improvements over apt-cacher which is in Perl. 


Install the shit and no need to configure it, 

apt install apt-cacher-ng 

grep var /etc/apt-cacher-ng/acng.conf 

cd /var/cache/ 

ls -ld apt-cacher-ng 

touch apt-cacher-ng/NOT_MOUNTED 

cat >> /etc/fstab <<EOF 

/dev/mapper/cachervg-cacherlv /var/cache/apt-cacher-ng ext4 defaults 0 2 


mount /var/cache/apt-cacher-ng/ 

grep apt /etc/passwd 

grep apt /etc/group 

chown apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng/ 

/etc/init.d/apt-cacher-ng restart 

ls -ld /var/cache/apt-cacher-ng/ 

ls -al /var/cache/apt-cacher-ng/ 


  /etc/init.d/apt-cacher-ng status 

  netstat -an --inet --inet6 | grep 3142 


Setup clients, 

cd /etc/apt/apt.conf.d/ 

vi 01proxy 

Acquire::http::Proxy "http://cacher:3142"; 


Eventually add this script to daily crontabs, to check for space usage, 

  df -h /boot / /var/cache/apt-cacher-ng 



You need a debian or ubuntu system to use apt-mirror. 


To create a repository mirror for Ubuntu 15.10 (wily), 

apt-get install apt-mirror 

apt-get install bozohttpd 

grep ^www /etc/inetd.conf 

netstat -an --inet --inet6 | grep LISTEN 

cd /var/www/ 

mkdir ubuntu_mirror/ 

ln -s ubuntu_mirror/mirror/ 

cd /etc/apt/ 

cp mirror.list mirror.list.dist 

vi mirror.list 


set base_path /var/www/ubuntu_mirror 

set defaultarch amd64 

set nthreads 20 

set limit_rate 40k 

deb-amd64 wily main main/debian-installer restricted restricted/debian-installer universe multiverse 

deb-amd64 wily-security main restricted universe multiverse 

deb-amd64 wily-updates main restricted universe multiverse 


cd /var/www/ 




Once the mirror is in place enable the cron job, 

cd /etc/cron.daily/ 

vi custom_apt-mirror 



chmod +x custom_apt-mirror 



If you get this error when the mirroring is done, 

  /bin/sh: 0: Can't open /var/www/ubuntu_mirror/var/ 

create the postmirror script as shown below, 

cd /var/www/ubuntu_mirror/var/ 




#rsync -avz --bwlimit=512 rsync:// /var/www/ 

rsync -avz --bwlimit=512 rsync:// /var/www/ 

chmod +x 

Note. you cannot put installer-amd64 into the mirror otherwise it will get wiped out by