如何设置 proxy

Git proxy

In .gitconfig

[http]
	proxy = http://10.206.133.47:3128
[user]
	email = name@email.com
	name = name

APT PROXY

In file /etc/apt/apt.conf

	Acquire::http::proxy "http://10.206.133.47:3128/";
	Acquire::https::proxy "http://10.206.133.47:3128/";
	Acquire::http::No-Cache=true;
	Acquire::https::No-Cache=true;
	Acquire::http::Pipeline-Depth '0';

PIP proxy

In file /root/.pip/pip.conf

[global]
index-url = http://pypi.douban.com/simple
proxy=http://10.206.133.47:3128
[install]
trusted-host=pypi.douban.com

设置 proxy时出现的各种错误

fatal: unable to access ‘https://github.com/spdk/spdk/’: server certificate verification failed. CAfile: none CRLfile: none

export GIT_SSL_NO_VERIFY=1 

git config --global http.sslVerify false

export http_proxy=http://10.206.133.47:3128

第二个错误:该错误 是因为没有设置proxy

Looking in indexes: http://pypi.douban.com/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPConnection 
object at 0x7faf6af6c700>, 'Connection to pypi.douban.com timed out. (connect timeout=15)')': /simple/fb-idb/
  • fatal: unable to access ‘https://github.com/spdk/spdk/’: server certificate verification failed. CAfile: none CRLfile: none

export GIT_SSL_NO_VERIFY=1 

git config --global http.sslVerify false

export http_proxy=http://10.206.133.47:3128

Install rust failed on SSL certificates

I try to install with the simplest way:

$ curl https://sh.rustup.rs -sSf | sh

and it ends with:

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to '/home/ildar/.rustup/tmp/smpm6z49tivc6git_file
info: caused by: error during download
info: caused by: [60] Peer certificate cannot be authenticated with given CA certificates (SSL certificate problem: unable to get local issuer certificate)
rustup: command failed: /tmp/.private/ildar/tmp.8kVhcIBdVQ/rustup-init

Solution: add correct certificates in /usr/local/share/ca-certificates/ , then sudo update-ca-certificates
在这里插入图片描述

sudo kubeadm config images pull get stocked

sudo kubeadm config images pul
[sudo] password for yaoxin: 
W0920 15:40:27.559827   94042 version.go:104] could not fetch a Kubernetes version from the internet: unable to get URL "https://dl.k8s.io/release/stable-1.txt": Get "https://dl.k8s.io/release/stable-1.txt": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W0920 15:40:27.559935   94042 version.go:105] falling back to the local client version: v1.25.1
failed to pull image "registry.k8s.io/kube-apiserver:v1.25.1": output: E0920 15:42:57.731385   94238 remote_image.go:242] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.1\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.1\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.1\": dial tcp 34.107.244.51:443: i/o timeout" image="registry.k8s.io/kube-apiserver:v1.25.1"
time="2022-09-20T15:42:57+02:00" level=fatal msg="pulling image: rpc error: code = Unknown desc = failed to pull and unpack image \"registry.k8s.io/kube-apiserver:v1.25.1\": failed to resolve reference \"registry.k8s.io/kube-apiserver:v1.25.1\": failed to do request: Head \"https://registry.k8s.io/v2/kube-apiserver/manifests/v1.25.1\": dial tcp 34.107.244.51:443: i/o timeout"
, error: exit status 1
To see the stack trace of this error execute with --v=5 or higher

solution

yaoxin@master:~$ sudo systemctl set-environment HTTP_PROXY=10.206.133.47:3128
yaoxin@master:~$ sudo systemctl set-environment HTTPS_PROXY=10.206.133.47:3128
yaoxin@master:~$ sudo systemctl restart containerd.service
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值