设置代理
清华大学
echo 'export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup' >> ~/.bash_profile
source ~/.bash_profile
阿里云
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup' >> ~/.bash_profile
echo 'export RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup' >> ~/.bash_profile
source ~/.bash_profile
中国科学技术大学
echo 'export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup' >> ~/.bash_profile
source ~/.bash_profile
字节跳动
echo 'export RUSTUP_DIST_SERVER=https://rsproxy.cn/rustup' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup/rustup' >> ~/.bash_profile
source ~/.bash_profile
上海交通大学 (SJTUG)
echo 'export RUSTUP_DIST_SERVER=https://mirrors.sjtug.sjtu.edu.cn/rustup' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.sjtug.sjtu.edu.cn/rustup/rustup' >> ~/.bash_profile
source ~/.bash_profile
华中科技大学 (HUST)
echo 'export RUSTUP_DIST_SERVER=https://mirrors.hust.edu.cn/rustup' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.hust.edu.cn/rustup/rustup' >> ~/.bash_profile
source ~/.bash_profile
官方
echo 'export RUSTUP_DIST_SERVER=https://static.rust-lang.org' >> ~/.bash_profile
echo 'export RUSTUP_UPDATE_ROOT=https://static.rust-lang.org/rustup' >> ~/.bash_profile
source ~/.bash_profile
执行静默安装
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
龙芯源
https://rust-lang.loongnix.cn/rustup-init.sh
安装指定版本
国内镜像可能不存在低版本
rustup install 1.74.0
rustup default 1.74.0
设置代理
中国科学技术大学源
mkdir -p ~/.cargo
cat > ~/.cargo/config.toml << EOF
[source.crates-io]
replace-with = 'ustc'
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
EOF
阿里云
mkdir -p ~/.cargo
cat > ~/.cargo/config.toml << EOF
[source.crates-io]
replace-with = 'aliyun'
[source.aliyun]
registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"
EOF