目录

Go开发常用的代理

概述

下面介绍一些作为 Go 开发常见的代理。

GOPROXY

1
2
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

Ubuntu apt代理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
cat > /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF

绕过一些安全方面的配置,不建议,但是可以用。

1
2
apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
apt -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true install iputils-ping

CentOS yum代理

pip代理

不是每个镜像都有 python 环境的,可以通过 apt-get install python-pip 安装,可以参考上文提到的内容。

1
2
3
4
5
6
7
8
9
mkdir ~/.pip/
touch ~/.pip/pip.conf
cat > ~/.pip/pip.conf <<"EOF"
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com
EOF

参考资料

  1. aliyun mirror
  2. go proxy
  3. aliyun apt
  4. aliyun yum
警告
本文最后更新于 2021年1月2日,文中内容可能已过时,请谨慎参考。