APT Proxy

Configure >
Before I get started...

Do you really need a proxy cache for apt packages?? If you are running a server with multiple machines to update all the time, then definitely yes.

But if you are a single user with one or two systems installed, then there is actually an easier way to share the packages from APT. You can just mount -bind the /var/cache/apt/archives dir to the same location on another system that you mount somewhere, or mount and chroot.
 
This would be difficult with live-build which caches in three places.

You could even rsync the packager over with rsync -arult .
 



Some choices of apt proxies are:

Approx - a little complex to set up, needing a super-server, such as rinetd or xinetd, to call it on demand. Import from apt cache function. I still can't get this to work.

Apt-cacher-ng - more straight-forward and it works, although apt still keeps installed deb archives in its own cache, so that's in two places on the disk (until you run apt clean). Cache is stored in a repository structure and import is possible. Cleaning is done through its web browser control page.

squid-deb-proxy - easiest to install, but the cache is unreadable - accessible by root and structured as a web proxy.

Approx

 
http://www.debianadmin.com/...


set the mirror and un-comment some lines in the file
 

e.g.
 

The file uses aliases followed by mirror addresses. The aliases are used in the sources.list file, tagged onto "server:port" e.g.
http://approx:9999/debian

How it can work for devuan I'm not sure, probably by ignoring aliases and including the devuan repository path in sources, eg.
deb http://approx:9999/deb.devuan.org/merged/dists/beowulf

Or with only the apt conf proxy file:
 
and paste in this
 


then setup xinetd
 
And append following text:
 
user=approx or root?

To restart xinetd service type the command:
# /etc/init.d/xinetd restart

To stop xinetd service type the command:
# /etc/init.d/xinetd stop

To stop xinetd service type the command:
# /etc/init.d/xinetd start

Verify that xinetd is running
# /etc/init.d/xinetd status

.../linux-how-do-i-configure-xinetd-service/
(only gives partial detail!)


import the apt cache into approx cache (only works if deb files are recent)
 





Apt-cacher-ng

This proxy works very well indeed, and it requires less work to setup!

https://www.tecmint.com/...
https://www.unix-ag.uni-kl.de/...

Install with
 

edit the conf file:
 
and uncheck these lines

BindAddress: 0.0.0.0
ReportPage: acng-report.html
PidFile: /var/run/apt-cacher-ng/pid

and ignore the sources lines

save the file, and then restart the proxy with:
 

For APT, create the file /etc/apt/apt.conf.d/99HttpProxy and fill with this content:
 

To let apt use the proxy with each install command, add this line to your ~/.bashrc file (single user) or to /etc/env (for global) -not sure if it's entirely necessary though.
 



import deb files
 
(or use ln to make symlinks)

open the Report page in a browser: http://localhost:3142/acng-report.html
then Click Start import

To clean the proxy cache, you need the report page too.

To clean the deb archives stored by apt in /var/cache/apt/archives (obtained through the proxy and used to install on system) just run `sudo apt clean`(this will not clean the proxy cache).

Note: do not add localhost:3142 [server:port] to every repo line in sources.list - if you do you will create a mirror cache in /var/cache/apt-cacher-ng called "localhost"!




Squid-deb-proxy

By far the easiest to setup, just install with Install with
 

and edit the conf file, adding your repo source(s):
 

No need to add a proxy conf file to /etc/apt/




Home | Content | Site Map | TOP