← Back to Rust Course | Chapter 1: Setup & Basics | Lesson 2 of 7

Rustup से Rust Install करना

Rustup एक छोटा helper program है जो आपके computer पर Rust download और setup करता है ताकि आप coding शुरू कर सकें।

Installing Rustup

Rustup Rust install और manage करने का official तरीका है।

Linux और macOS पर, आप एक single shell command चलाते हैं जो rustup installer download और run करता है, जो फिर rustc compiler, cargo build tool, और standard library install करता है।

Note: Installer खत्म होने के बाद, एक नई terminal खोलें या source $HOME/.cargo/env चलाएं ताकि नए commands आपके PATH पर हों।

उदाहरण: Installing Rustup

bash
# Linux/macOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Windows
# Download and run rustup-init.exe from https://rustup.rs

⚠️ Run this in your own terminal or Node.js environment.

Checking the Installed Version

एक बार install होने के बाद, आप compiler और Cargo build tool से उनके version numbers पूछकर confirm कर सकते हैं कि Rust तैयार है। कोई code लिखने से पहले यह जांचने का सबसे तेज़ तरीका है कि install काम कर गया।

उदाहरण: Checking the Installed Version

bash
rustc --version
cargo --version

⚠️ Run this in your own terminal or Node.js environment.

Updating Rust

Rust हर लगभग छह हफ्तों में नई stable releases ship करता है। rustup update latest stable toolchain fetch करता है ताकि आपके पास हमेशा current compiler features और standard library additions हों।

उदाहरण: Updating Rust

bash
rustup update stable

⚠️ Run this in your own terminal or Node.js environment.

Confirming From Inside a Program

आप एक असली Rust program compile और run करके भी verify कर सकते हैं कि आपकी toolchain end-to-end काम करती है। अगर यह सही print करे, तो आपकी installation पूरी और functional है।

उदाहरण: Confirming From Inside a Program

markup
// Entry point: execution of the program starts here
fn main() {
    // Print "Rust toolchain is installed and working!" to the console (with a trailing newline)
    println!("Rust toolchain is installed and working!");
}
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. rustup उपयोग करने के बजाय एक system package manager से Rust install करने की कोशिश करना और इसके बजाय एक पुराना version पाना।
  2. terminal restart (या shell profile reload) करना भूल जाना, जिससे cargo और rustc commands नहीं मिलते।
  3. समय-समय पर rustup update न चलाना, जो आपको एक पुराने compiler पर छोड़ देता है जिसमें नए language features नहीं हैं।
चैप्टर सारांश
  • Rustup Rust के लिए official installer और version manager है, जो rustc, cargo, और standard tooling cover करता है।
  • Linux/macOS पर आप rust-lang.org से एक shell script चलाकर इसे install करते हैं; Windows पर एक dedicated installer है।
  • rustup update आपकी toolchain को current रखता है, और rustup show दिखाता है कि क्या installed है।
  • Installation के बाद, rustc --version और cargo --version confirm करते हैं कि सब कुछ काम कर रहा है।
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.