Press "Enter" to skip to content

Linux指定yum使用proxy server

1,在第三方机器上建立一个proxy server
推荐使用这个Repo,一个其于Pyhon的小巧的HTTP/HTTPS代理服务器,体积仅有200K。

git clone https://github.com/inaz2/proxy2.git
cd proxy2
python proxy2.py 3128

这样,一个建立在3128端口上的HTTP/HTTPS代理就建立好了。

2,配置本机使用HTTP代理

$ export http_proxy=http://172.22.193.65:3128
$ export https_proxy=http://172.22.193.65:3128

然后,你会发现,yum/wget/ez_install可以正常使用了。

curl的话,可以使用如下命令使用proxy server

$ curl -L --fail https://github.com/docker/compose/releases/download/1.12.0/run.sh > ~/1.sh -x http://172.22.193.65:3128

3,解决yum提示[Errno 14] Peer cert cannot be verified or peer cert invalid
这种是由于proxy server上面的ca证书不被认可,解决方案为Adding “sslverify=false” in the ‘/etc/yum.conf’ file。

$ vim /etc/yum.conf  #添加或修改如下选项
sslverify=false

$ yum repolist all
Leave a Reply

Your email address will not be published. Required fields are marked *