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:
- Open a terminal with sudo privileges.
- Refresh the APT package index.
$ sudo apt update
- 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.
- 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.
- 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.
- 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.
- Check the Rust compiler version.
$ rustc --version rustc 1.96.0 (ac68faa20 2026-05-25)
- Check the Cargo version.
$ cargo --version cargo 1.96.0 (30a34c682 2026-05-25)
- 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 - 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.
- 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.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.