1. 临时设置

sudo apt-get -o Acquire::http::proxy="http://127.0.0.1:8000/" update

2. 永久设置

创建/etc/apt/apt.conf

touch /etc/apt/apt.conf

写入如下内容:

Acquire::http::Proxy "http://yourproxyaddress:proxyport";

如果proxy需要密码,则格式如下:

Acquire::http::Proxy "http://username:password@yourproxyaddress:proxyport";

Reference: https://www.jianshu.com/p/fdae9cb5181b

https://askubuntu.com/questions/257290/configure-proxy-for-apt