You need to add one line to the APT configuration file /etc/apt/apt.conf or to custom file /etc/apt/apt.conf.d/99proxy:
Acquire::http::Proxy "http://[[user][:pass]@]host[:port]";
where
[[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 squid-deb-proxy).
Example: 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
Removal:
sudo rm /etc/apt/apt.conf.d/99proxy
# or
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.