APT and Snapd and Cargo and Git and go tools Config

3 篇文章 0 订阅

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值