Set a predictable IP address by either:
Setting your DHCP server to assign the IP
Setting up a static IP
Suggestions for IP Address: Set the IP Address to the Raspberry Pi Version, for example, this is my home network:
192.168.0.3 - Raspberry Pi 3
192.168.0.4 - Raspberry Pi 4 ethernet
192.168.0.40 - Raspberry Pi 4 wlan
If I get more Raspberry Pis, I may extend to use double digits, for Example:
192.168.0.30 - Raspberry Pi 3 #1
192.168.0.31 - Raspberry Pi 3 #2
192.168.0.40 - Raspberry Pi 4 #1
192.168.0.41 - Raspberry Pi 4 #2
192.168.0.42 - Raspberry Pi 4 #3
If you switch out your SD cards often enough, you may want to disable StrictHostKeyChecking
.
Inside ~/.ssh/config
:
Host 192.168.0.10StrictHostKeyChecking noUserKnownHostsFile=/dev/null
Assuming you are using Raspbian.
sudo apt install apt-cacher-ng
This will enable a HTTP maintenance page on the server, for example http://192.168.0.3:3142/acng-report.html (change to your server ip)
sudo apt install squid-deb-proxy-client
​Debian Wiki for AptCatcherNg issues a security warning as the server is detected on the network via mDNS.
Do not install auto-apt-proxy
and squid-deb-proxy-client
at the same time. auto-apt-proxy
's configuration will override squid-deb-proxy-client.
tail -f /var/log/apt-cacher-ng/apt-cacher.log
We are going to install rolldice
a simple package which is easily removable, so its great for testing
sudo apt install rolldice
On the server
, observe you are getting a request from the client
.
1569616597|O|11680|192.168.0.4|raspbian.raspberrypi.org/raspbian/pool/main/r/rolldice/rolldice_1.16-1+b1_armhf.deb
To remove rolldice
:
sudo apt remove rolldice
apt-cacher-ng
is a proxy and stores files in /var/cache/apt-cacher-ng/
. apt-catcher-ng
will publicize it exists over mDNS using avahi-daemon
.
To test if the server
is being detected run:
/usr/share/squid-deb-proxy-client/apt-avahi-discover
This should return the server URL, for example:
http://192.168.0.3:3142/
If does not happen, test to see if the server is publicizing itself.
On the client
, we first need avahi-browse
, which exists in the avahi-utils
package.
sudo apt install avahi-utils
On the client
after installation we can run avahi-browse
:
avahi-browse -a | grep apt_proxy
Look for a line similar to:
+ eth0 IPv4 apt-cacher-ng proxy on pi3 _apt_proxy._tcp local
If this line does not appear, then your client
is not detecting your server
.
If your client detects the server, but the server is not caching check your client
apt directory /etc/apt/apt.conf.d/
for files which may configure your apt proxy
grep -R Proxy /etc/apt/apt.conf.d/*
Links:
​Apt-Catcher NG homepage​
Debian wiki: https://wiki.debian.org/AptCacherNg​