apt设置代理
打开apt代理配置文件
vi /etc/apt/apt.conf.d/proxy.conf
添加如下代理信息:
Acquire::http::Proxy "http://username:password@proxy-server-ip:8181/";
Acquire::https::Proxy "https://username:password@proxy-server-ip:8182/";
备注:使用export设置代理对apt无效
curl代理设置
直接在命令中加代理参数,具体如下:
curl -x "http://user:pwd@127.0.0.1:1234" "http://httpbin.org/ip"
curl --proxy "http://user:pwd@127.0.0.1:1234" "http://httpbin.org/ip"
此外,在 环境变量中设置临时设置代理:
# 设置 http proxy
export http_proxy="http://user:pwd@127.0.0.1:1234"
# 设置 https proxy
export https_proxy="http://user:pwd@127.0.0.1:1234"
取消 http,https 代理
unset http_proxy
unset https_proxy
或者在配置文件(如.bashrc)中配置代理
# 设置 http proxy
export http_proxy="http://user:pwd@127.0.0.1:1234"
# 设置 https proxy
export https_proxy="http://user:pwd@127.0.0.1:1234"
对curl同样生效
docker设置代理
Docker代理配置
git设置代理
git配置网络代理









网友评论