软件代理镜像

GFW不要折磨我了

pip

配置文件
~/.config/pip/pip.conf

  • 代理
    编辑文件
[global]
proxy=http://127.0.0.1:1087

注意不支持socks5

  • 镜像
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

NPM

代理

npm config set proxy http://127.0.0.1:1087
npm config set https-proxy http://127.0.0.1:1087

取消代理

npm config delete proxy
npm config delete https-proxy

用socks5就报错- -

推荐使用yarn,npm是真的慢

  1. 镜像
npm config set registry https://registry.npmmirror.com
  1. 验证命令
npm config get registry

如果返回https://registry.npmmirror.com,说明镜像配置成功。

https://my.oschina.net/tangshi/blog/699190
https://stackoverflow.com/questions/7559648/is-there-a-way-to-make-npm-install-the-command-to-work-behind-proxy
https://blog.csdn.net/yanzi1225627/article/details/80247758

git

SSH代理

在 文件 ~/.ssh/config 后添加下面两行

Host github.com
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p

gitclone.com加速

git config --global url."https://gitclone.com/".insteadOf https://

https://gitclone.com/

HTTP代理

git config --global http.proxy http://127.0.0.1:1087

建议使用http, 因为socks5 在使用git-lfs时会报错proxyconnect tcp: dial tcp: lookup socks5: no such host

https://gist.github.com/laispace/666dd7b27e9116faece6

curl

socks5 = "127.0.0.1:1080"

配置文件
~/.curlrc

https://www.zhihu.com/question/31360766

go get

HTTP_PROXY=socks5://localhost:1080 go get

测试了下HTTPS_PROXY和ALL_PROXY都不起作用

OR使用goproxy.io

yarn

设置代理

yarn config set proxy http://127.0.0.1:1080
yarn config set https-proxy http://127.0.0.1:1080

不支持socks5

镜像

yarn config set registry https://registry.npmmirror.com
# 验证
yarn config get registry

https://github.com/yarnpkg/yarn/issues/3418

https://learnku.com/articles/15976/yarn-accelerate-and-modify-mirror-source-in-china

wget

配置文件
~/.wgetrc

use_proxy=yes
http_proxy=127.0.0.1:1087
https_proxy=127.0.0.1:1087

https://stackoverflow.com/questions/11211705/how-to-set-proxy-for-wget

snap

sudo snap set system proxy.http="http://127.0.0.1:1087"
sudo snap set system proxy.https="http://127.0.0.1:1087"

https://askubuntu.com/questions/764610/how-to-install-snap-packages-behind-web-proxy-on-ubuntu-16-04#answer-1146047

docker

$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vim /etc/systemd/system/docker.service.d/proxy.conf

[Service]
Environment="ALL_PROXY=socks5://127.0.0.1:1080"

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

必须是socks5,http不生效

镜像源

vim /etc/docker/daemon.json
# 添加
{"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com"]}
# 重启服务
systemctl daemon-reload
systemctl restart docker

https://segmentfault.com/a/1190000023117518