You can genrate the proxy conf in /etc/apt/apt.conf, Or in /etc/apt/apt.conf.d/proxy.conf
(1) Method-1
# vim /etc/apt/apt.conf
Acquire::http::Proxy "http://PROXYSERVERIP:PROXYPORT";
Acquire::https::Proxy "https://PROXYSERVERIP:PROXYPORT";
(2) Method-2
# vim /etc/apt/apt.conf
Acquire {
HTTP::proxy "http://PROXYSERVERIP:PROXYPORT";
HTTPS::proxy "http://PROXYSERVERIP:PROXYPORT";
}
(1) Method-1
# snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
# snap set system proxy.https="http://<proxy_addr>:<proxy_port>"
(2) Method-2
# vim /etc/environment
http_proxy=http://<proxy_addr>:<proxy_port>
https_proxy=http://<proxy_addr>:<proxy_port>
# systemctl restart snapd.service
(3) Method-3
# systemctl edit snapd.service
[Service]
Environment=http_proxy=http://<proxy_addr>:<proxy_port>
Environment=https_proxy=http://<proxy_addr>:<proxy_port>
# systemctl daemon-reload
# systemctl restart snapd.service
# git config --global http.proxy http:/proxy_ip:port
# git config --global https.proxy https://proxy_ip:port
# cat ~/.gitconfig
[http]
proxy = http://proxy_ip:port
[https]
proxy = http://proxy_ip:port
When Shadow Socks used as the proxy,so you need another method:
# cat ~/.gitconfig
[http]
proxy = socks5://proxy_ip:port
[https]
proxy = socks5://proxy_ip:port
# git config --global http.sslVerify false
# git config --global https.sslVerify false
debian@debian:~/Desktop$ cat ~/.cargo/config
[http]
proxy = "socks5://127.0.0.1:1080"
[https]
proxy = "socks5://127.0.0.1:1080"
Maybe, Other Proxy follows as below:
debian@debian:~/Desktop$ cat ~/.cargo/config
[http]
proxy = "http://127.0.0.1:1080"
[https]
proxy = "http://127.0.0.1:1080"
debian@debian:sudo mkdir -p /etc/systemd/system/docker.service.d
debian@debian:sudo vim /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy_ip:port"
Environment="HTTPS_PROXY=http://proxy_ip:port"
Environment="NO_PROXY="localhost,127.0.0.1,::1"
debian@debian:sudo systemctl daemon-reload
debian@debian:sudo systemctl restart docker
debian@debian: http_proxy=127.0.0.1:1080 go build -o sample-controller .
debian@debian: https_proxy=127.0.0.1:1080 go build -o sample-controller .
为Snapd设置代理
Use Git Behind a Proxy
How to set the Proxy for Docker on Ubuntu