代理服务器是位于请求资源的客户端系统或最终用户与资源本身之间的中间服务器。在大多数情况下,代理服务器充当最终用户和互联网之间的网关。
1:配置代理文件
如没有proxy.conf文件,按照目录创建一个即可!
vim /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://username:password@proxy-IP-address:proxyport";
Acquire::https::Proxy "http://username:password@proxy-IP-address:proxyport";
例如:
$ vim /etc/apt/apt.conf.d/proxy.conf
Acquire::http::Proxy "http://8.8.8.8:8080/";
Acquire::https::Proxy "http://8.8.8.8:8080/";
配置完成后apt update执行一下即可
另一种写法:
#无账户密码
Acquire {
http::Proxy "http://proxy-IP-address:proxyport/";
https::Proxy "http://proxy-IP-address:proxyport/";
}
#有账户密码
Acquire {
http::Proxy "http://username:password@proxy-IP-address:proxyport/";
https::Proxy "http://username:password@proxy-IP-address:proxyport/";
}