Rust install on WSL 2

Hello, how are you doing?
I am trying to install Rust on WSL 2(Ubuntu windows subsystem).
But I can't install it because of some reason.
Does anyone have experience in this?

I have Rust installed on WSL2, could you give more info about your situation?

Thank you for your reply.

I tried many times but I got this error.

The Rust site suggests using

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Maybe try that? I don't know if the extra options would make a difference, but it's worth a shot

You could try to ping rustup.rs first to see if you can connect to it. You can also try wget to download the script, which is more user-friendly

1 Like

Are you using a VPN? If so, the instructions at Troubleshooting Windows Subsystem for Linux | Microsoft Docs might help.

2 Likes

I installed the rust with this guide

But I faced another issue when I run source $HOME/.cargo/env.

I installed the rust with this guide

But I faced another issue when I run source $HOME/.cargo/env .

I guess you shouldn't have installed it with sudo. In this case, then env script might not be under ~/.cargo/env, you can try to find it under /usr/lib/local?

If you run the install script as root it will probably install it under /root rather than your personal home directory as /root is the home directory of root. Rustup is meant to be installed as the user using it.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.