apt設(shè)置代理
打開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設(shè)置代理對apt無效
curl代理設(shè)置
直接在命令中加代理參數(shù),具體如下:
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"
此外,在 環(huán)境變量中設(shè)置臨時設(shè)置代理:
# 設(shè)置 http proxy
export http_proxy="http://user:pwd@127.0.0.1:1234"
# 設(shè)置 https proxy
export https_proxy="http://user:pwd@127.0.0.1:1234"
取消 http,https 代理
unset http_proxy
unset https_proxy
或者在配置文件(如.bashrc)中配置代理
# 設(shè)置 http proxy
export http_proxy="http://user:pwd@127.0.0.1:1234"
# 設(shè)置 https proxy
export https_proxy="http://user:pwd@127.0.0.1:1234"
對curl同樣生效
docker設(shè)置代理
Docker代理配置
git設(shè)置代理
git配置網(wǎng)絡(luò)代理