Skip to content

Set Proxy for Debian apt Command

If your VM behind a firewall, you may need to run apt command with a proxy server.

Here is the example,

Bash
# one time
sudo apt -o Acquire::http::proxy="http://USERNAME:PASSWORD@SERVER:PORT" upgrade # http proxy
sudo apt -o Acquire::https::proxy="https://USERNAME:PASSWORD@SERVER:PORT" upgrade # https proxy

# permanent
nano /etc/apt/apt.conf
Acquire::http::Proxy "http://USERNAME:PASSWORD@SERVER:PORT";
Acquire::https::Proxy "https://USERNAME:PASSWORD@SERVER:PORT";