常用镜像和代理整理

npm/yarn

yarn:以下设置将 npm 换成 yarn 即可

  • 设置代理
1
$ npm config set proxy http://127.0.0.1:1080
  • 设置淘宝镜像
1
2
3
4
$ npm config set registry https://registry.npm.taobao.org/
$ npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
$ npm config set electron_mirror http://npm.taobao.org/mirrors/electron/
$ npm config set puppeteer_download_host https://npm.taobao.org/mirrors/

Docker

  • 安装 docker
1
$ curl -sSL https://get.daocloud.io/docker | sh
  • 安装 docker-compose
1
2
$ curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
  • 换源
1
$ curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

1
https://r3w482u8.mirror.aliyuncs.com

Git

  • 设置代理(仅对 https 协议有效)
1
$ git config --global http.proxy http://127.0.0.1:1080

Ubuntu 18.04

很多 docker 镜像同样可用

1
2
3
4
5
6
7
8
9
10
echo -e "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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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" > /etc/apt/sources.list
0%