Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Apt Repository Cache

From Thibble Wiki

Apt Repository Cache

"apt-cache-ng" is a apt repository package which allows the configuration of a apt repository cache server, acting much like a windows update cache server but for Linux distributions such as Debian or Ubuntu. This service will log and cache package files as well as provide a web interface for monitoring usage and other statistics.

Setup

First start with a fresh installation for your server, and a static IP address. In my case I used Debian 12.

1. Start with a fresh update

sudo apt update && apt install upgrade

2. Next install the package

sudo apt install apt-cacher-ng

3. Now alow the required ports through your machine firewall. The service runs on port 3142.

Example for ufw:

sudo ufw allow 3142/tcp

4. Now you have a basic installation. You should be able to navigate to the servers IP, using port 3142, and see the web interface including usage.

Client Configuration

Now that we have the server configured and running, and we verified it with the presence of the web UI, we can configure the Client side. This is done simply by adding one like to a file, in your Clients apt DConf folder.

1. Run the following command, to generate a file called "00cacher" and populate it with the config line. make sure to update the IP address to match that of your caching server

echo 'Acquire::http::Proxy "http://cacheserver:3142";' \
  > /etc/apt/apt.conf.d/00cacher

Now you are done! Running an apt update, make sure you do not see any errors, if you do there is likely a misconfiguration in the client config file.

Going back over to the server you should find activity in the cacher log located at

/var/log/apt-cacher-ng/apt-cacher.log

and you should also now see content stored in

/var/cache/apt-cacher-ng/