当前位置: 首页 > 工具软件 > cargo-edit > 使用案例 >

APT and Snapd and Cargo and Git and go tools Config

羊慈
2023-12-01

APT Config

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";
}

Snapd Config

(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

Shell Env Set

# git config --global http.proxy http:/proxy_ip:port
# git config --global https.proxy https://proxy_ip:port

Git Configure

# 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

Cargo config

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"

Docker

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

Go tools

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 .

Reference

为Snapd设置代理
Use Git Behind a Proxy
How to set the Proxy for Docker on Ubuntu

 类似资料:

相关阅读

相关文章

相关问答