Rust development on Ubuntu needs the compiler, Cargo, rustup, and a system linker available in the same shell before packages can build. The upstream rustup installer gives the developer account a current stable toolchain, while APT supplies the TLS certificates, download client, and C build tools that the installer and Cargo rely on.

rustup installs command proxies under ~/.cargo/bin and keeps toolchains under ~/.rustup. Loading $HOME/.cargo/env updates the current terminal, while new login shells usually pick up the path change from the shell profile that rustup updates.

The rustup-managed path fits developer accounts that need to manage Rust releases, components, and project-specific toolchain changes. Ubuntu packages for rustc and Cargo can serve distro-maintained builds, but rustup is the route recommended by Rust for most developers and matches the current stable Cargo workflow.

Steps to install the Rust toolchain on Ubuntu:

  1. Open a terminal with sudo privileges.
  2. Refresh the APT package index.
    $ sudo apt update
  3. Install the Ubuntu prerequisites.
    $ sudo apt install --assume-yes curl ca-certificates build-essential

    curl downloads the installer, ca-certificates lets it validate the HTTPS endpoint, and build-essential provides the C compiler and linker used by many Cargo builds.

  4. Install rustup and the default stable Rust toolchain as the developer user.
    $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
    info: downloading installer
    info: default host triple is aarch64-unknown-linux-gnu
    info: default toolchain set to stable-aarch64-unknown-linux-gnu
      stable-aarch64-unknown-linux-gnu installed - rustc 1.96.0 (ac68faa20 2026-05-25)
    
    Rust is installed now. Great!

    Do not run the installer with sudo. rustup writes user-owned files under ~/.cargo and ~/.rustup so the same account can update toolchains later.

  5. Load the Cargo environment into the current terminal.
    $ . "$HOME/.cargo/env"

    Opening a new terminal after installation usually has the same effect because rustup updates the user's shell profile.

  6. Confirm the active Rust toolchain.
    $ rustup show active-toolchain
    stable-aarch64-unknown-linux-gnu (default)

    x86_64 Ubuntu systems report stable-x86_64-unknown-linux-gnu instead of stable-aarch64-unknown-linux-gnu.

  7. Check the Rust compiler version.
    $ rustc --version
    rustc 1.96.0 (ac68faa20 2026-05-25)
  8. Check the Cargo version.
    $ cargo --version
    cargo 1.96.0 (30a34c682 2026-05-25)
  9. Create a sample Cargo project.
    $ cargo new hello-rust
        Creating binary (application) `hello-rust` package
    note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
  10. Run the sample project through Cargo.
    $ cargo run --manifest-path hello-rust/Cargo.toml
       Compiling hello-rust v0.1.0 (/home/alex/hello-rust)
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
         Running `hello-rust/target/debug/hello-rust`
    Hello, world!

    This checks the compiler, Cargo, and system linker together instead of stopping at version commands.

  11. Remove the sample project.
    $ rm -r hello-rust

    This removes only the throwaway verification project. It does not remove rustup, Cargo, or the installed Rust toolchain.