Gebruikershulpmiddelen

Site-hulpmiddelen


linux:network:div:debian-approx

Debian approx

PS-release: PS-stretch
PS-pkg: net::approx
approx: 5.7-3

1. What is Debian approx?

Approx is an HTTP-based proxy server for Debian-style package archives.
 It fetches files from remote repositories on demand,
 and caches them for local use.
 .
 Approx saves time and network bandwidth if you need to install or
 upgrade .deb packages for a number of machines on a local network.
 Each package is downloaded from a remote site only once,
 regardless of how many local clients install it.
 The approx cache typically requires a few gigabytes of disk space.
 .

(From: apt-cache show approx)

2. Controlling the service

2.1 systemd.socket

The Debian approx service has been designed for invokation by the “inetd”.1) It cannot be run from the commandline. However in version 5.7-1 approx was patched for use with the “systemd.socket” service. 2)

In Debian stretch approx is invoked by “systemd.socket” by default.

2.2 Stop/start the service

# systemctl stop approx.socket
# systemctl start approx.socket

2.3 Show status

# systemctl status approx.socket
* approx.socket - caching proxy server for Debian archive files
   Loaded: loaded (/lib/systemd/system/approx.socket; enabled; vendor preset: en
   Active: active (listening) since Thu 2018-12-20 19:01:05 UTC; 1 day 16h ago
     Docs: man:approx(8)
   Listen: [::]:80 (Stream)
 Accepted: 18; Connected: 0
# systemctl list-units approx.socket
UNIT          LOAD   ACTIVE SUB       DESCRIPTION                               
approx.socket loaded active listening caching proxy server for Debian archive fi

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
  • More info: $ man systemctl

3. Configuration

3.1 Configure repositories and parameters

/etc/approx/approx.conf:

debian      http://deb.debian.org/debian
security    http://security.debian.org/debian-security

Principally Debian approx can be used for cacheing every file-based repository:

mozilla     http://ftp.mozilla.org/pub

Now in a script you can do:

$ curl -o firefox-64.0.tar.bz2 http://approx:9999/mozilla/firefox/releases/64.0/linux-x86_64/en-US/firefox-64.0.tar.bz2

Enable debugging:

$debug      true
  • Since every request launches a new approx instance, changes take effect immediately. No service restart is needed.

3.2 Configure listen port

/lib/systemd/system/approx.socket:

[Socket]
# ListenStream=9999
ListenStream=80

Restart service:

# systemctl daemon-reload

# systemctl restart approx.socket

Copyright © 2018 Tux4u.be - Author: Marjan Waldorp; debian-approx.md 2018-12-22

2)
systemd.socket is a replacement for inetd.
linux/network/div/debian-approx.txt · Laatst gewijzigd: 2018/12/30 17:17 (Externe bewerking)