How to configure Apt-cacher-ng clients-in a network

| | 2 min read

The apt-cacher-ng configuration requires certain changes to be made on the client side. Few changes has to be made on the client system so that during the download process the client system can check for the packages in the apt-cacher-ng server. And if the apt-cacher-ng server doesn't have the required package it will download it from the web. So the client configuration helps to make the download more faster and also helps to reduce the internet connection usage.

The few things that are to be noted before configuring apt-cacher-ng clients are

  1. Check whether you have configured the apt-cacher-ng server correctly.
  2. Check the IP-address of the apt-cacher-ng server.

As we have noted down the two things we can start configuring the client machine. Now we have to make the changes on all the machines in the network. The first step is to point the client machine to the server. For this add the following line to /etc/apt/apt.conf.

 Acquire::http { Proxy "http://your server:3142/"; }; 

If this file doesnot exist in the above mentioned location you have to create one and add this line in that file.

Now you might want to import all packages from /var/cache/apt/archive. For this, you have to create a folder a inside the cachedirectory and move all the packages to that particular folder.

 sudo mkdir -p /path/to/cachedir/new-folder-name   
 cp /var/cache/apt/archives/* /path/to/cachdir/new-folder-name/ 

Then go to the “statistics report and configuration page” on server and click the import button. Once this is finished you have to delete the files from /var/cache/apt/archives/ .

Hope this helps.