apt-cacher-ng
is an alternative to a more robust apt proxy servers available such as squid-deb-proxy
. If you are running a small home or office network look no further. It may lack some of the more advanced features but it can be configured in no time, that is, you are ready to go within minutes after initial installation.
Server
Let’s get started by configuring apt-cacher-ng server:
# apt-get install apt-cacher-ng
Enable to start apt-cacher-ng
after reboot:
# systemctl enable apt-cacher-ng
and start apt-cacher-ng
apt proxy:
# service apt-cacher-ng start
That is it. Your apt proxy server is now configured and ready for requests. The default caching location directory is /var/cache/apt-cacher-ng/
which stores all downloaded packages. Further configuration of apt-cacher-ng
can be achieved by editing it’s main config file /etc/apt-cacher-ng/acng.conf
Client
Using your server’s IP address eg. 10.1.1.16
create a new apt config file eg. 30proxy
with a following content:
Acquire::http { Proxy "http://10.1.1.16:3142"; };
and store it into /etc/apt/apt.conf.d/
directory while replacing the above IP address with an IP address of your apt proxy server. All done.
Troubleshooting
To make sure that your apt-cacher-ng
proxy started check for a listening port 3142:
tcp 0 0 0.0.0.0:3142 0.0.0.0:* LISTEN tcp6 0 0 :::3142 :::* LISTEN
Furthermore, check for a correct functioning by examining apt-cacher-ng
‘s log files /var/log/apt-cacher-ng/apt-cacher.log
which stores all relevant requests and /var/log/apt-cacher-ng/apt-cacher.err
for possible error messages.