安装或者升级rust前,编辑或生成config.toml文件,速度会飞快。其中:
1.Linux下执行下列命令:
# for bash
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup' >> ~/.bash_profile
echo 'export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup' >> ~/.bash_profile
2.windows下为username\.cargo\config,Linux下是/root/.cargo/config或/home/username/.cargo/config。
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 替换成目标镜像源
replace-with = 'sjtu'
# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
# 中国科学技术大学
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
# rustcc社区 1号源
[source.rustcc]
registry= "git://crates.rustcc.com/crates.io-index"
# rustcc社区 2号源
[source.rustcc2]
registry= "git://crates.rustcc.cn/crates.io-index"
# 阿里云源1
[source.ali]
registry = "https://code.aliyun.com/rustcc/crates.io-index"
# 阿里云源2
[source.aliyun]
registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"
# 字节跳动源1
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
# 字节跳动源2
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
# 字节跳动源3
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true