Setup apt-cacher-ng to keep the deb packages local cache.

Apt-cacher-ng keep a local cache of all downloaded deb packages for next installation, the existing deb packages also can be add to the apt-cacher-ng local cache.
First Install the apt-cacher-ng:

apt install apt-cacher-ng
To setup the apt-cacher-ng for your linux edit the /etc/sources.list:
deb http://127.0.0.1:3142/mirror.yandex.ru/ubuntu/ artful main restricte
deb http://127.0.0.1:3142/mirror.yandex.ru/ubuntu/ artful main restricte
Or create a file 02apt-cacher to the /etc/apt/apt.conf.d:
Acquire::http { Proxy "http://127.0.0.1:3142"; };
apt-cacher-ng listening to the 3142 port of localhost.
Then run the:
apt-get update
apt-cacher-ng default cache directory is /var/cache/apt-cacher-ng, modify the default cache directory from the /etc/apt-cacher-ng/acng.conf with the CacheDir option:
CacheDir: /var/cache/apt-cacher-ng
LogDir: /var/log/apt-cacher-ng
Port:3142
To open the apt-cacher-ng in a web browser, open the url:
http://localhost:3142/acng-report.html
To import the existing downloaded deb packages to the apt-cacher-ng, open the /var/cache/apt-cacher-ng and creat a diretory _import, and change the ownership of directory to apt-cacher-ng:
cd /var/cache/apt-cacher-ng
mkdir _import
chown -R apt-cacher-ng:apt-cacher-ng _import
Now copy your deb pcakages or directories containing the deb packages to the _import directory, and the ownership of deb packages also should be apt-cacher-ng.
Open the apt-cacher-ng in web browser and click on the Start Import. Always import the new downloaded deb packages from the /var/cache/apt/archives to the apt-cacher-ng as described above.


<< Previous Next >>