各种开发工具国内加速配置

简介

​各种开发工具配置国内加速

git

设置代理

1
2
3
4
5
6
7
8
9
10
11
12
13
#设置全局socks5代理

git config --global http.proxy socks5://127.0.0.1:10808

# 设置全局http代理
git config --global http.proxy http://127.0.0.1:10809


# 取消当前代理
git config --unset http.proxy

#取消全局代理
git config --global --unset http.proxy

查看代理

1
git config --global http.proxy

maven

1
2
3
4
5
6
7
8
9

<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>

go

设置

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

查看

1
go env

containerd

查看当前配置信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
yum install -y jq
crictl info | jq .config.registry

{
"mirrors": {
"docker.io": {
"endpoint": [
"https://docker.mirrors.ustc.edu.cn"
],
"rewrite": null
}
},
"configs": null,
"auths": null,
"headers": null

修改

1
2
3
4
5
6
cp /var/lib/rancher/k3s/agent/etc/containerd/config.toml /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl

# 在 config.toml.tmpl 文件中添加
[plugins.cri.registry.mirrors]
[plugins.cri.registry.mirrors."docker.io"]
endpoint = ["https://docker.mirrors.ustc.edu.cn"]

重启

1
systemctl restart k3s

docker

修改 /etc/docker/daemon.json

1
2
3
4
5
{

"registry-mirrors": ["http://hub-mirror.c.163.com"]

}

重启服务

1
systemctl restart docker

yarn

查看

1
yarn config get registry

设置成淘宝镜像

1
2
3
4
5
6
7
8
9
yarn config set registry http://registry.npm.taobao.org/

yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g
yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g
yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g

npm

查看

1
npm get registry

设置成淘宝镜像

1
2
3
4
5
6
7
8
9
npm config set registry http://registry.npm.taobao.org/

npm install phantomjs --phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs
npm install chromedriver --chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
npm install operadriver --operadriver_cdnurl=http://npm.taobao.org/mirrors/operadriver
npm config set disturl https://npm.taobao.org/dist
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

ubuntu

备份之前的sources.list文件

1
sudo cp -ra /etc/apt/sources.list /etc/apt/sources.list.bak

修改sources.list文件

1
sudo vim /etc/apt/sources.list
  • ubuntu 18.04 lts (bionic)
1
2
3
4
5
6
7
8
9
10
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
  • ubuntu 20.04 lts (focal)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

更新apt缓存

1
2
sudo apt update
sudo apt upgrade

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×