sudo http_proxy=http://yourserver apt-get update
Setting Up Proxy for APT
On some systems, the apt command-line utility needs a separate proxy configuration, because it does not use system environment variables.
1. To define proxy settings for apt, create or edit (if it already exists) a file named apt.conf in /etc/apt directory:
sudo nano /etc/apt/apt.conf
2. Add the following lines to the file:
Acquire::http::Proxy "http://[username]:[password]@ [proxy-web-or-IP-address]:[port-number]";
Acquire::https::Proxy "http://[username]:[password]@ [proxy-web-or-IP-address]:[port-number]";
3. Save the file and exit. The configuration will be applied after a reboot.
https://phoenixnap.com/kb/ubuntu-proxy-settings