<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://it-arts.net/index.php?action=history&amp;feed=atom&amp;title=APT-CACHER-NG_-_Advanced_Config</id>
	<title>APT-CACHER-NG - Advanced Config - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://it-arts.net/index.php?action=history&amp;feed=atom&amp;title=APT-CACHER-NG_-_Advanced_Config"/>
	<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=APT-CACHER-NG_-_Advanced_Config&amp;action=history"/>
	<updated>2026-05-02T18:46:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://it-arts.net/index.php?title=APT-CACHER-NG_-_Advanced_Config&amp;diff=839&amp;oldid=prev</id>
		<title>Admin: Text replacement - &quot;Category:Wiki&quot; to &quot;Category:Wiki

&#039;&#039;&#039;&#039;&#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&#039;&#039;&#039;&#039;&#039;
&quot;</title>
		<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=APT-CACHER-NG_-_Advanced_Config&amp;diff=839&amp;oldid=prev"/>
		<updated>2026-01-17T06:51:36Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;&amp;quot; to &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;  &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:51, 17 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Wiki]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Wiki]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&#039;&#039;[https://it-arts.net/index.php/Category:Wiki Return to Wiki Index]&#039;&#039;&#039;&#039;&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Architecture and Internal Design ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Architecture and Internal Design ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://it-arts.net/index.php?title=APT-CACHER-NG_-_Advanced_Config&amp;diff=716&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;Category:Wiki  == Architecture and Internal Design ==  APT-Cacher-NG (ACNG) acts as a specialized HTTP proxy optimized for package managers such as APT.   Unlike generic proxies, it understands repository layouts and package metadata patterns.  === Request Flow === # Client sends HTTP request for a package or index file # ACNG checks its local cache directory # If present and valid, the cached object is served # If missing or expired, ACNG fetches it from the upstrea...&quot;</title>
		<link rel="alternate" type="text/html" href="https://it-arts.net/index.php?title=APT-CACHER-NG_-_Advanced_Config&amp;diff=716&amp;oldid=prev"/>
		<updated>2025-12-20T15:29:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php/Category:Wiki&quot; title=&quot;Category:Wiki&quot;&gt;Category:Wiki&lt;/a&gt;  == Architecture and Internal Design ==  APT-Cacher-NG (ACNG) acts as a specialized HTTP proxy optimized for package managers such as APT.   Unlike generic proxies, it understands repository layouts and package metadata patterns.  === Request Flow === # Client sends HTTP request for a package or index file # ACNG checks its local cache directory # If present and valid, the cached object is served # If missing or expired, ACNG fetches it from the upstrea...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Wiki]]&lt;br /&gt;
&lt;br /&gt;
== Architecture and Internal Design ==&lt;br /&gt;
&lt;br /&gt;
APT-Cacher-NG (ACNG) acts as a specialized HTTP proxy optimized for package managers such as APT.  &lt;br /&gt;
Unlike generic proxies, it understands repository layouts and package metadata patterns.&lt;br /&gt;
&lt;br /&gt;
=== Request Flow ===&lt;br /&gt;
# Client sends HTTP request for a package or index file&lt;br /&gt;
# ACNG checks its local cache directory&lt;br /&gt;
# If present and valid, the cached object is served&lt;br /&gt;
# If missing or expired, ACNG fetches it from the upstream repository&lt;br /&gt;
# The fetched object is stored and indexed locally&lt;br /&gt;
&lt;br /&gt;
=== Cache Storage Model ===&lt;br /&gt;
* Cache root usually located in &amp;lt;code&amp;gt;/var/cache/apt-cacher-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Files are stored using a hashed directory structure&lt;br /&gt;
* Metadata files (.db, .head) are maintained for validation and expiration&lt;br /&gt;
* Index files are cached separately from binary packages&lt;br /&gt;
&lt;br /&gt;
=== Protocol Support ===&lt;br /&gt;
* HTTP (native)&lt;br /&gt;
* HTTPS via CONNECT tunneling (limited inspection)&lt;br /&gt;
* IPv4 and IPv6&lt;br /&gt;
&lt;br /&gt;
=== Performance Characteristics ===&lt;br /&gt;
* Optimized for many small files (package indexes)&lt;br /&gt;
* Handles concurrent clients efficiently&lt;br /&gt;
* Reduces bandwidth and mirror load significantly in multi-host environments&lt;br /&gt;
&lt;br /&gt;
== Configuration Directives (Advanced) ==&lt;br /&gt;
&lt;br /&gt;
Configuration files are typically located in &amp;lt;code&amp;gt;/etc/apt-cacher-ng&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Important Configuration Files ===&lt;br /&gt;
* &amp;lt;code&amp;gt;acng.conf&amp;lt;/code&amp;gt; – main configuration&lt;br /&gt;
* &amp;lt;code&amp;gt;security.conf&amp;lt;/code&amp;gt; – access control rules&lt;br /&gt;
* &amp;lt;code&amp;gt;backends_*.conf&amp;lt;/code&amp;gt; – repository mappings&lt;br /&gt;
&lt;br /&gt;
=== Cache Behavior Tuning ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
CacheDir: /var/cache/apt-cacher-ng&lt;br /&gt;
ExTreshold: 4&lt;br /&gt;
MaxSpareThreadCount: 20&lt;br /&gt;
MaxThreads: 100&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ExTreshold&amp;lt;/code&amp;gt;: expiration sensitivity for index files&lt;br /&gt;
* &amp;lt;code&amp;gt;MaxThreads&amp;lt;/code&amp;gt;: controls parallel client handling&lt;br /&gt;
* &amp;lt;code&amp;gt;MaxSpareThreadCount&amp;lt;/code&amp;gt;: idle worker threads kept alive&lt;br /&gt;
&lt;br /&gt;
=== Repository Remapping ===&lt;br /&gt;
&lt;br /&gt;
ACNG can remap repository URLs to alternative mirrors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Remap-debian: file:deb_mirror*.conf&lt;br /&gt;
Remap-ubuntu: file:ubuntu_mirror*.conf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This allows transparent redirection without client-side changes.&lt;br /&gt;
&lt;br /&gt;
== Client Configuration and Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== System-Wide APT Proxy Configuration ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Acquire::http::Proxy &amp;quot;http://proxy-server:3142&amp;quot;;&lt;br /&gt;
Acquire::https::Proxy &amp;quot;http://proxy-server:3142&amp;quot;;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Per-Command Proxy Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apt-get -o Acquire::http::Proxy=&amp;quot;http://proxy-server:3142&amp;quot; update&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Verifying Proxy Usage ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apt-get -o Debug::Acquire::http=true update&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logs should show requests routed through the ACNG proxy.&lt;br /&gt;
&lt;br /&gt;
== Cache Management and Maintenance ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Cache Cleanup ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apt-cacher-ng -c /etc/apt-cacher-ng -s&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Removes expired and orphaned files&lt;br /&gt;
* Rebuilds internal metadata databases&lt;br /&gt;
&lt;br /&gt;
=== Cache Statistics ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
curl http://localhost:3142/acng-report.html&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Provides:&lt;br /&gt;
* Cache hit ratio&lt;br /&gt;
* Disk usage&lt;br /&gt;
* Traffic savings&lt;br /&gt;
* Active connections&lt;br /&gt;
&lt;br /&gt;
=== Pre-Fetching Packages ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apt-get --download-only install linux-image-amd64&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Used on one client to populate cache for others.&lt;br /&gt;
&lt;br /&gt;
== Security Concepts ==&lt;br /&gt;
&lt;br /&gt;
=== Access Control ===&lt;br /&gt;
&lt;br /&gt;
Access rules are defined in &amp;lt;code&amp;gt;security.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Allow: 192.168.1.0/24&lt;br /&gt;
Deny: all&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Supports CIDR notation&lt;br /&gt;
* First-match rule evaluation&lt;br /&gt;
* Deny rules should always be explicit&lt;br /&gt;
&lt;br /&gt;
=== Authentication Limitations ===&lt;br /&gt;
* ACNG does not natively support user authentication&lt;br /&gt;
* Intended for trusted networks&lt;br /&gt;
* Authentication must be enforced externally (firewall, VPN)&lt;br /&gt;
&lt;br /&gt;
=== HTTPS Considerations ===&lt;br /&gt;
* HTTPS repositories are tunneled, not cached at object level&lt;br /&gt;
* Index files may still be cached depending on client behavior&lt;br /&gt;
* Full HTTPS caching requires repository-specific configuration&lt;br /&gt;
&lt;br /&gt;
=== Network-Level Hardening ===&lt;br /&gt;
* Bind to specific interface:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
BindAddress: 192.168.1.10&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use firewall rules to restrict access to port 3142&lt;br /&gt;
* Recommended to run behind NAT or internal VLAN&lt;br /&gt;
&lt;br /&gt;
=== Privilege Model ===&lt;br /&gt;
* Runs as unprivileged user&lt;br /&gt;
* No need for root access during normal operation&lt;br /&gt;
* Writes only to cache and log directories&lt;br /&gt;
&lt;br /&gt;
== Logging and Monitoring ==&lt;br /&gt;
&lt;br /&gt;
=== Log Files ===&lt;br /&gt;
* &amp;lt;code&amp;gt;/var/log/apt-cacher-ng/access.log&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;/var/log/apt-cacher-ng/error.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Log Verbosity ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
VerboseLog: 1&lt;br /&gt;
Debug: 7&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Higher debug levels significantly increase log volume.&lt;br /&gt;
&lt;br /&gt;
=== Common Log Patterns ===&lt;br /&gt;
* &amp;lt;code&amp;gt;HIT&amp;lt;/code&amp;gt; – served from cache&lt;br /&gt;
* &amp;lt;code&amp;gt;MISS&amp;lt;/code&amp;gt; – fetched from upstream&lt;br /&gt;
* &amp;lt;code&amp;gt;EXPIRED&amp;lt;/code&amp;gt; – revalidated content&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Clients Bypass the Cache ===&lt;br /&gt;
* Verify proxy settings on client&lt;br /&gt;
* Ensure no conflicting proxy definitions&lt;br /&gt;
* Check access.log for incoming requests&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
grep MISS /var/log/apt-cacher-ng/access.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Permission Errors in Cache Directory ===&lt;br /&gt;
* Check ownership of cache directory&lt;br /&gt;
* Ensure sufficient disk space&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Slow Package Downloads ===&lt;br /&gt;
* Check upstream mirror responsiveness&lt;br /&gt;
* Increase thread limits&lt;br /&gt;
* Verify DNS resolution&lt;br /&gt;
&lt;br /&gt;
=== Repository Not Cached ===&lt;br /&gt;
* Ensure repository uses HTTP&lt;br /&gt;
* Verify remap configuration&lt;br /&gt;
* Some third-party repositories disable caching headers&lt;br /&gt;
&lt;br /&gt;
=== Service Fails to Start ===&lt;br /&gt;
* Check error.log for syntax errors&lt;br /&gt;
* Validate configuration files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apt-cacher-ng -c /etc/apt-cacher-ng -t&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
&lt;br /&gt;
* Official APT-Cacher-NG Homepage  &lt;br /&gt;
  https://www.unix-ag.uni-kl.de/~bloch/acng/&lt;br /&gt;
&lt;br /&gt;
* APT-Cacher-NG Git Repository  &lt;br /&gt;
  https://salsa.debian.org/blade/apt-cacher-ng&lt;br /&gt;
&lt;br /&gt;
* Debian Wiki – APT-Cacher-NG  &lt;br /&gt;
  https://wiki.debian.org/AptCacherNg&lt;br /&gt;
&lt;br /&gt;
* Ubuntu Documentation – Package Caching  &lt;br /&gt;
  https://help.ubuntu.com/community/Apt-Cacher%20NG&lt;br /&gt;
&lt;br /&gt;
* APT Configuration Manual  &lt;br /&gt;
  https://manpages.debian.org/apt.conf&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>