常用依赖镜像源

一句话:从右边几个源中寻找对应软件即可 清华源 中科大源 阿里源 淘宝源 。当然如果能科学上网可忽略,不过大多数时候使用国内镜像源会更快一些。

趁这波换电脑,顺便整理了一番个人日常开发中需要替换的国内镜像源。

Python

pip

以下命令会添加配置至$HOME/.config/pip/pip.conf

1
2
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pyenv

修改v变量,一键安装对应Python版本

1
v=3.8.3;wget https://npm.taobao.org/mirrors/python/$v/Python-$v.tar.xz -P $(pyenv root)/cache/;pyenv install $v

Golang

go module

1
2
export GO111MODULE=on
export GOPROXY='https://goproxy.cn'

Node.js

npm

1
npm config set registry https://registry.npm.taobao.org

yarn

1
yarn config set registry https://registry.npm.taobao.org/

Arch

pacman

覆盖原有/etc/pacman.d/mirrorlist,可以先备份原有文件

1
2
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch

archlinuxcn

添加至原/etc/pacman.conf末尾

1
2
[archlinuxcn]
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch

AUR

1
yay --aururl "https://aur.tuna.tsinghua.edu.cn" --save

Ubuntu

20.04LTS

覆盖原有/etc/apt/srouces.list

1
2
3
4
5
6
7
8
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

18.04LTS版本将所有 focal 替换成 bionic 即可

Alpine

1
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

Homebrew

Core

1
2
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

Cask

1
2
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

不定时更新中…