Rate This Document
Findability
Accuracy
Completeness
Readability

Failed to Download and Install Rust Using Commands

Symptom

When Rust is downloaded and installed using commands, the installation is suspended for a long time, causing an error reported.

Key Process and Cause Analysis

The network environment does not support file download.

Conclusion and Solution

  1. Download the file rustup-init.sh from https://sh.rustup.rs for manual installation. If the system displays a message indicating that the binary file cannot be downloaded during the running of the script, manually download the binary file rustup-init through the link provided in the message.

  2. Perform the installation.
    1
    ./rustup-init -y -v
    

    If the execute permission is requried, run the chmod +x rustup-init command as the root user to grant the permission.

    Certificate problems may occur when the binary file is executed. In this case, configure an image repository. The installation may take some time. If the operation fails, try again.

    • Tsinghua University repository
      1
      2
      export RUSTUP_UPDATE_ROOT='https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup'
      export RUSTUP_DIST_SERVER='https://mirrors.tuna.tsinghua.edu.cn/rustup'
      
    • University of Science and Technology of China (USTC)repository
      1
      2
      export RUSTUP_DIST_SERVER='https://mirrors.ustc.edu.cn/rust-static' 
      export RUSTUP_UPDATE_ROOT='https://mirrors.ustc.edu.cn/rust-static/rustup'