I am currently using cellular connection most of the time. Thus, it is obvious that I prefer to reduce the amount of data transferred over the network.
Significant portion of it is reduced by the apt caching proxy apt-cacher-ng as I use Debian Linux distribution and VirtualBox on daily basis.
Install application
To install apt caching proxy execute the following command.
$ sudo apt-get install apt-cacher-ng
apt-cacher-ng
service will start automatically and listen on the 3142
port.
Protect maintenance page
To protect maintenance page edit /etc/apt-cacher-ng/security.conf
configuration file to set username and password.
$ sudo vi /etc/apt-cacher-ng/security.conf
# This file contains confidential data and should be protected with file # permissions from being read by untrusted users. # # NOTE: permissions are fixated with dpkg-statoverride on Debian systems. # Read its manual page for details. # Basic authentication with username and password, required to # visit pages with administrative functionality. Format: username:password AdminAuth: administrator:secretpassword
Access maintenance page
Open http://localhost:3142 URL and navigate to the Statistics report and configuration page or jump directly to the http://localhost:3142/acng-report.html web page.
Adjust application settings
Edit /etc/apt-cacher-ng/acng.conf
configuration file to define addresses/hostnames and port to listen on.
$ sudo vi /etc/apt-cacher-ng/acng.conf
[...] BindAddress: localhost 10.10.10.11 [...] Port:3142 [...]
Configure APT
Instruct APT to use recently configured proxy.
$ sudo vi /etc/apt/apt.conf.d/00proxy
Acquire::http::Proxy "http://10.10.10.11:3142";
Import packages
To import already downloaded packages you need to perform the following steps.
Create /var/cache/apt-cacher-ng/_import/
directory.
$ sudo mkdir /var/cache/apt-cacher-ng/_import/
Copy or move downloaded packages to the directory created in the previous step.
$ sudo cp /var/cache/apt/archives/*.deb /var/cache/apt-cacher-ng/_import/
Fix permissions.
$ sudo chown -R apt-cacher-ng:apt-cacher-ng /var/cache/apt-cacher-ng/_import
Initiate import on the maintenance page.
apt-get update
action on the machine using selected repository and apt cache proxy.Customize HTML templates
To customize default web page edit /usr/lib/apt-cacher-ng/userinfo.html
file.
$ sudo vi /usr/lib/apt-cacher-ng/userinfo.html
To customize maintenance web page /usr/lib/apt-cacher-ng/report.html
file.
$ sudo vi /usr/lib/apt-cacher-ng/report.html
Links
Visit Apt-Cacher NG website to read user manual, mailing list or bug tracker.