To make APT (apt-get command) work behind a proxy, apt.conf (which is found in /etc/apt/ directory) file must be edited.

Open apt.conf file with preferred editor:

nano /etc/apt/apt.conf

And add a new line with the proxy settings (or update if the line is already present):

Acquire::http::Proxy "http://user:password@server:port/";

Protect the proxy settings

By removing READ permissions for “all other users”:

stat /etc/apt/apt.conf
chmod 640 /etc/apt/apt.conf

Resources