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.
$ sudo apt update
$ 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.
$ 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.
$ . "$HOME/.cargo/env"
Opening a new terminal after installation usually has the same effect because rustup updates the user's shell profile.
$ 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.
$ rustc --version rustc 1.96.0 (ac68faa20 2026-05-25)
$ cargo --version cargo 1.96.0 (30a34c682 2026-05-25)
$ 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
$ 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.
$ rm -r hello-rust
This removes only the throwaway verification project. It does not remove rustup, Cargo, or the installed Rust toolchain.