rustup鏡像配置
rustup 安裝方法可參考 官方的 README.
設置環境變量 RUSTUP_DIST_SERVER
(用於更新 toolchain)
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
以及 RUSTUP_UPDATE_ROOT
(用於更新 rustup)
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
create.io鏡像配置
在 $HOME/.cargo/config 中添加如下內容
[registry] index = "git://mirrors.ustc.edu.cn/crates.io-index"
如果所處的環境中不允許使用 git 協議, 可以把上述地址改為
index = "http://mirrors.ustc.edu.cn/crates.io-index"
同步頻率為每兩個小時更新一次.
如果 cargo 版本為 0.13.0 或以上, 需要更改 $HOME/.cargo/config 為以下內容:
[source.crates-io] registry = "https://github.com/rust-lang/crates.io-index" replace-with = 'ustc' [source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index"