Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active August 18, 2025 06:26
Show Gist options
  • Save 4sskick/977d7c44df8537ac73dd648be4d1b168 to your computer and use it in GitHub Desktop.
Save 4sskick/977d7c44df8537ac73dd648be4d1b168 to your computer and use it in GitHub Desktop.
install RUST on WSL

Rust Installation via Alternative Method

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.


Installation Steps (Alternative Way)

  1. Download the tar.xz file
    Get it from: Other Rust Installation Methods

  2. Extract the archive

    tar -xvz <filename>
  3. Run the installer

    sudo ./install.sh
  4. End of the process showed:

    rust installed.
    

Post-Installation Issues

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.

Fixing by Setting Stable Toolchain

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

Using a Mirror Server

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)

Verifying Installation

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment