Ubuntu – How to make pbuilder use the apt-cacher-ng instance

apt-cacher-ngpbuilder

I have a apt-cacher-ng server on my LAN network, and I was wondering how I could "force" pbuilder to use it (to speed up package builds).

Typical setup client-side of the cache goes something like this:

In /etc/apt/apt.conf:

Acquire::http { Proxy "http://servername:3142"; };

Best Answer

Like this:

$ sudo pbuilder --login --save-after-login
# echo 'Acquire::http { Proxy "http://servername:3142"; };' > /etc/apt/apt.conf.d/02proxy
# exit
$

Alternatively, you could use the --execute option:

$ sudo pbuilder --execute --save-after-exec -- /tmp/setup-apt-proxy.sh

... where /tmp/setup-apt-proxy.sh contains commands to create /etc/apt/apt.conf.d/02proxy.