Setup on Debian with apt-cacher-ng
https://wiki.debian.org/AptCacherNg
apt install apt-cacher-ng apt install avahi-daemon
echo 'Acquire::http { Proxy "http://proxy:3142"; }' | sudo tee -a /etc/apt/apt.conf.d/proxy
should also work automatically with
apt install auto-apt-proxy