You need to add one line to the APT configuration file
/etc/apt/apt.conf or to custom file
[[user]:[pass]@] are credentials (
user is username,
pass is password);
host is hostname of proxy server or its IP;
[:port] is a port (
8000 in case of
http://192.168.12.34:8000 for anonymous proxy -
echo 'Acquire::http::Proxy "http://192.168.12.34:8000";' | sudo tee /etc/apt/apt.conf.d/99proxy
sudo rm /etc/apt/apt.conf.d/99proxy
mv /etc/apt/apt.conf.d/99proxy ~/
See the The Acquire group of man 5 apt.conf.
Note: this line may be added during installation via netboot installer if you have set proxy-server in it.