If you follow the official website, they recommend using the command:
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
But I encountered an OpenSSL connection peer reset error.
Since that failed, I tried another way, which succeeded.
-
Download the tar.xz file
Get it from: Other Rust Installation Methods -
Extract the archive
tar -xvz <filename>
-
Run the installer
sudo ./install.sh
-
End of the process showed:
rust installed.
After installation, when running:
cargo --version
I got this error:
error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
To fix this, I tried:
rustup default stable
But I got another error:
error: component download failed for clippy-x86_64-unknown-linux-gnu: could not download file from 'https://static.rust-lang.org/dist/2025-08-07/clippy-1.89.0-x86_64-unknown-linux-gnu.tar.xz' to '/home/monta/.rustup/downloads/...partial': error decoding response body: request or response body error: error reading a body from connection: connection reset
To solve the download issue, I set Rust mirrors:
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
Then, I ran again:
rustup default stable
This time, it downloaded successfully and finished with:
stable-x86_64-unknown-linux-gnu installed - rustc 1.89.0 (29483883e 2025-08-04)
cargo --version
# cargo 1.89.0 (c24e10642 2025-06-23)
rustc --version
# rustc 1.89.0 (29483883e 2025-08-04)
✅ And you're good to go!