How to install Rust in Windows under WSL - Tutorial
/If you're looking to develop Rust applications on Windows, one of the best ways to set up your environment is by using WSL (Windows Subsystem for Linux). WSL gives you a full Linux (Ubuntu) experience directly inside Windows, making it ideal for Rust development.
In this tutorial, we'll walk you through step-by-step how to install Rust inside your WSL environment. Whether you're completely new to WSL, or just want a clean Rust setup, this guide will have you up and running in no time. We'll cover installing WSL, setting up your Linux (Ubuntu) distribution, and installing Rust.
Tutorial
Instructions
Install Ubuntu with wsl
Check the previous installed ubuntus
wsl --list --verbose
# wsl --unregister Ubuntu-22.04 if exists
wsl --install Ubuntu-22.04
#Enter username: hatari password:labs
Update essential packages
sudo apt update
sudo apt install build-essential
Install Rust & Cargo using rustup
Remove previous rust versions
sudo apt remove --purge rustc cargo
sudo apt autoremove --purge
Open a terminal, then run:
curl https://sh.rustup.rs -sSf | sh
Press Enter
Activate Rust in your current terminal
source $HOME/.cargo/env
Test
rustc --version
cargo --version