apt

1
2
3
sudo sed -i.bak 's/archive.ubuntu.com/mirrors.cernet.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/mirrors.cernet.edu.cn/g' /etc/apt/sources.list
sudo apt update

pacman

ref: https://mirrors.tuna.tsinghua.edu.cn/help/msys2/

1
sed -i "s#https\?://mirror.msys2.org/#https://mirrors.tuna.tsinghua.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*

pdm

1
pdm config pypi.url https://mirrors.cernet.edu.cn/pypi/web/simple

pip

1
pip config set global.index-url https://mirrors.cernet.edu.cn/pypi/web/simple

conda

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cat <<'EOF' > ~/.condarc
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.cernet.edu.cn/anaconda/pkgs/main
- https://mirrors.cernet.edu.cn/anaconda/pkgs/r
- https://mirrors.cernet.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.cernet.edu.cn/anaconda/cloud
pytorch: https://mirrors.cernet.edu.cn/anaconda/cloud
nvidia: https://mirrors.sustech.edu.cn/anaconda-extra/cloud
EOF

conda clean -i

npm

1
2
3
npm config set registry https://repo.nju.edu.cn/repository/npm/
yarn config set registry https://repo.nju.edu.cn/repository/npm/
pnpm config set registry https://repo.nju.edu.cn/repository/npm/

Reference