APT-CACHER-NG

a Debian/Ubuntu package proxy

INSTALL

debian

apt install apt-cacher-ng

slackware

look for latest and build it

wget http://ftp.debian.org/debian/pool/main/a/apt-cacher-ng/apt-cacher-ng_3.2.orig.tar.xz
tar xJf apt-cacher-ng_3.2.orig.tar.xz
cd apt-cacher-ng-3.2/
#grep -i wrap CMakeLists.txt
mkdir build
cd build
cmake ..
make -j5
make install

mkdir -p /var/log/apt-cacher-ng/
mkdir -p /var/cache/apt-cacher-ng/

setup

cd /etc/apt-cacher-ng/
#cd /usr/local/etc/apt-cacher-ng/

mv -i acng.conf acng.conf.dist
sed -r '/^[[:space:]]*(#|$)/d' acng.conf.dist > acng.conf.clean
sed -r '/^[[:space:]]*(#|$)/d' acng.conf.dist > acng.conf

egrep '^CacheDir|^LogDir' acng.conf
ls -alF /var/log/apt-cacher-ng/
ls -alF /var/cache/apt-cacher-ng/

vi acng.conf

fix empty Sourceforge mirror list

#Remap-sfnet:  file:sfnet_mirrors

slackware w/ v3.2.orig w/o libwrap

UseWrap: 0

let the https links pass through

PassThroughPattern: .*

or only one specific https repo to pass through

PassThroughPattern: repo\.protonvpn\.com:443$

listen only locally (and eventually use an ssh tunnel)

#BindAddress: localhost

acceptance

netstat -lntup | grep 3142

service is reachable –either– remotely

http://CACHER-ADDRESS:3142

–or– through some tunnel

ssh -L 3142:localhost:3142 CACHER-SERVER

http://localhost:3142

ready to go

tail -F /var/log/apt-cacher-ng/apt-cacher.{err,log}

debian/ubuntu

systemctl restart apt-cacher-ng
systemctl status apt-cacher-ng
systemctl enable apt-cacher-ng

slackware

start & enable at boot time

vi /etc/rc.local

echo -n starting apt-cacher-ng...
/usr/local/sbin/apt-cacher-ng -c /usr/local/etc/apt-cacher-ng && echo done || echo FAILED

status

pgrep -a apt-cacher-ng
ps auxfww | grep cacher | grep -v grep
netstat -lntup --inet --inet6 | grep cacher

stop

pkill apt-cacher-ng

shared

after a while

find /var/cache/apt-cacher-ng/
du -sh /var/cache/apt-cacher-ng/

client setup

nmap -p 3142 x.x.x.x
vi /etc/apt/apt.conf.d/01proxy

Acquire::http { Proxy "http://x.x.x.x:3142"; };

or against a specific repository

Acquire::http::Proxy::external.repo.host "http://your.proxy.host/";

apply

apt update

resources

https://www.unix-ag.uni-kl.de/~bloch/acng/

https://www.tecmint.com/apt-cache-server-in-ubuntu/

https://github.com/vector-im/riot-web/issues/3573

client setup

https://serverfault.com/questions/482318/apt-get-proxy-for-specific-repos


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun