How to Install Rust on Ubuntu: The Official Stable Toolchain Through APT

Rust gives you C-level performance with memory safety checked at compile time, and a build tool, cargo, that most other ecosystems envy. It also moves fast: a new stable compiler lands every six weeks, crates start using freshly stabilised features almost immediately, and a crate whose rust-version is newer than your compiler will not build at all.

Ubuntu packages Rust as rustc and cargo, frozen per release: Noble’s default rustc is 1.75, and newer compilers only appear as separately versioned rustc-1.XX packages with commands to match. Most people end up on rustup, which installs the official toolchain into each user’s home directory and keeps it current with rustup update. That is fine on a laptop, but on a shared machine or a build server it means one toolchain per user and an update mechanism that APT knows nothing about.

The unofficial deb.griffo.io repository provides rust-stable: the official Rust stable toolchain, the exact binaries rustup fetches from static.rust-lang.org, packaged once for the whole system and moved forward by apt upgrade with every release.

Install the Latest Rust on Ubuntu: The Short Version

If you only came for the commands, this adds the repository and installs the latest Rust toolchain on Ubuntu:

sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
sudo apt update
sudo apt install rust-stable

The rest of this guide covers what the package contains and replaces, how to add musl and WebAssembly targets, which rustup habits change, and how to troubleshoot.

What You Get With rust-stable

  • 🦀 A complete toolchain - rustc, cargo, rustdoc, rustfmt, clippy, rust-analyzer, rust-gdb, rust-lldb and the host standard library, all from one release.
  • 🔏 Official, verified binaries - The release manifest’s signature is checked against the Rust release signing key and every tarball against the manifest’s SHA-256, then the files are installed exactly as published.
  • 👥 Shared by every user - One toolchain in /usr/lib/rust-stable instead of a ~/.rustup per account.
  • 🧩 Always a matched set - Compiler, cargo, standard library, clippy and rustfmt upgrade together, so they can never drift apart.
  • 🎯 Targets as packages - musl for static binaries and three WebAssembly targets, each installed with apt.
  • 📚 Source and docs on disk - rust-stable-src for rust-analyzer, and rust-stable-doc for offline reading.

Why Use the deb.griffo.io Repository?

  • Current stable Rust through APT, published within hours of each release, every six weeks plus point releases.
  • Exactly what rustup installs, verified against the Rust release signing key (fingerprint 108F 6620 5EAE B0AA A8DD 5E1C 85AB 96E6 FA1B E5FE) and the manifest’s checksums, never rebuilt or patched.
  • Plain rustc and cargo commands: no versioned names like rustc-1.XX, just the usual commands in /usr/bin, on every user’s PATH.
  • Builds work immediately: the package depends on a C compiler (gcc or clang) and libc6-dev, which rustc needs for linking.
  • Man pages and completions for cargo, in bash and zsh.
  • Works across supported Ubuntu releases on amd64 and arm64, with the codename detected for you.

Prerequisites

Before starting, confirm you have:

  • An Ubuntu system (Jammy 22.04 LTS, Noble 24.04 LTS, Questing 25.10, or Resolute 26.04 LTS)
  • An amd64 or arm64 machine (a Raspberry Pi 4 or 5 on a 64-bit OS is arm64)
  • sudo privileges
  • curl installed (sudo apt install curl if needed)
  • Room on disk: about 680 MB for the toolchain, and 100 to 230 MB per extra target

Other architectures that upstream supports, such as armhf, are not packaged here; rustup remains the option there.

Step 1: Add the deb.griffo.io Repository

Register the key and repository source:

# Create the keyrings directory
sudo install -d -m 0755 /etc/apt/keyrings

# Download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg

# Add the repository (auto-detects your distro codename)
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null

# Update the package list
sudo apt update

Breaking it down:

  1. Create the keyrings directory - makes sure /etc/apt/keyrings exists with the right permissions.
  2. Install the GPG key - downloads and de-armours the repository key into its own keyring so APT can verify signatures.
  3. Add the repository - writes a signed-by source line, letting lsb_release -sc fill in your Ubuntu codename.
  4. Update the package list - refreshes APT’s view of available packages.

Step 2: Update the Package List

If you did not run the final command above, do it now:

sudo apt update

Then confirm the package is visible:

apt policy rust-stable

The candidate should come from https://deb.griffo.io/apt.

Step 3: Install rust-stable

Install with APT:

sudo apt install rust-stable

rust-stable-src comes along by default as a recommended package, so rust-analyzer can read the standard library source.

What APT Replaces on Ubuntu

Ubuntu, like Debian, splits Rust into rustc, cargo, libstd-rust-dev, rustfmt, rust-clippy and friends, all locked to the same version. A newer package that only took over the rustc name would put a new compiler next to Ubuntu’s old standard library and break every build, which is why the full toolchain is shipped as one package with its own name.

rust-stable replaces Ubuntu’s rustc, cargo, rustfmt, rust-clippy, rust-gdb, rust-lldb, rust-analyzer and rustup packages, and on Noble the old rustc-1.74 and cargo-1.74. APT shows the list and asks before removing anything. Packages that depend on the distribution’s compiler, such as python3-setuptools-rust or dh-cargo, go with them.

Two things are left alone: the system LLVM and clang, and Ubuntu’s newer versioned packages (rustc-1.XX, cargo-1.XX), which stay installable side by side because their commands carry the version in the name.

Step 4: Verify the Installation

Check the versions:

rustc --version
cargo --version

You should see something like:

rustc 1.100.1 (...)
cargo 1.100.1 (...)

And make sure the companions are present:

cargo clippy --version
rustfmt --version
rust-analyzer --version

Getting Started with Rust

Hello, Cargo

cargo new hello
cd hello
cargo run

cargo generates Cargo.toml and src/main.rs, compiles them and runs the binary:

   Compiling hello v0.1.0 (/home/you/hello)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.40s
     Running `target/debug/hello`
Hello, world!

For an optimised binary in target/release/:

cargo build --release

The Everyday Loop

Everything you need for linting, formatting, testing and documentation ships in the one package:

# Lints for bugs and unidiomatic code
cargo clippy

# Format every file in the project
cargo fmt

# Unit, integration and doc tests
cargo test

# Generate API docs for your crate and dependencies, and open them
cargo doc --open

Dependencies

Let cargo add update Cargo.toml:

cargo add serde --features derive
cargo add anyhow
cargo build

Crates are fetched from crates.io into each user’s ~/.cargo/registry, just as with rustup.

Tools From crates.io

cargo install places binaries in ~/.cargo/bin. The packaged toolchain does not edit your shell profile, so add that directory to PATH if you have not already:

echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc

Fully Static Binaries With musl

Binaries linked against musl do not depend on the system’s glibc, which makes them easy to copy between machines of the same architecture, including older Ubuntu releases. The musl target brings its own musl, so musl-tools is not required:

sudo apt install rust-stable-std-musl

# aarch64-unknown-linux-musl on arm64
cargo build --release --target x86_64-unknown-linux-musl

# No shared libraries needed
ldd target/x86_64-unknown-linux-musl/release/hello

WebAssembly Targets

# For the browser: wasm-bindgen, Trunk, Leptos, Yew
sudo apt install rust-stable-std-wasm32-unknown-unknown

# WASI preview 1 and preview 2, for runtimes such as wasmtime
sudo apt install rust-stable-std-wasm32-wasip1 rust-stable-std-wasm32-wasip2

cargo build --target wasm32-wasip2

Where you would have run rustup target add, install the matching package instead.

Editors, Debuggers and Documentation

  • Language server: rust-analyzer is in /usr/bin, ready for any editor with an LSP client, and rust-stable-src lets it navigate the standard library.
  • Debugging: rust-gdb and rust-lldb load Rust’s pretty-printers into gdb or lldb (install the debugger itself separately).
  • Offline docs: sudo apt install rust-stable-doc installs the std API, The Book, Rust by Example, the Cargo book and the reference under /usr/share/doc/rust-stable-doc/html. At around 760 MB it is only suggested, never pulled in automatically.

Coming From rustup

Without rustup, a few commands map to APT:

  • rustup update is now sudo apt update && sudo apt upgrade.
  • rustup target add <target> is now sudo apt install rust-stable-std-<target>.
  • rustup component add rust-src is now sudo apt install rust-stable-src.
  • rust-toolchain.toml files are read by rustup, so they are ignored here.

Need nightly, an older pinned toolchain or an unpackaged target? Use rustup for that project instead.

Keeping Rust Updated

The toolchain now follows your normal Ubuntu upgrades:

sudo apt update && sudo apt upgrade

Each stable and point release arrives through apt upgrade, and every Rust package you installed, the toolchain, source, docs and targets, moves to the new version at the same time.

Other Tools from deb.griffo.io

The repository includes many tools that sit well next to Rust:

  • Zig - another systems language and toolchain, packaged here as a stable release.
  • Helix - a terminal modal editor with language server support built in, ready for rust-analyzer.
  • Zed - a fast code editor written in Rust.
  • Neovim - the Vim-based editor whose built-in LSP client works with rust-analyzer.
  • just - a Rust-written command runner for project tasks.

Troubleshooting

GPG or Key Errors

If APT flags the repository as unsigned or the key as invalid, re-import it:

curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update

Package Not Found

If APT cannot locate rust-stable:

  1. Re-run sudo apt update after adding the repository.
  2. Verify your Ubuntu release is supported (Jammy, Noble, Questing, or Resolute).
  3. Check that dpkg --print-architecture reports amd64 or arm64.
  4. Check the source list: cat /etc/apt/sources.list.d/deb.griffo.io.list.

Also make sure you asked for rust-stable: rustc and cargo are Ubuntu’s own packages.

An Older rustc Still Runs

Look for another rustc ahead of /usr/bin on your PATH, usually rustup’s proxies:

which -a rustc cargo

If ~/.cargo/bin/rustc is listed first, rustup still wins for your user. Remove it with rustup self uninstall if you want the packaged toolchain everywhere; note that this deletes ~/.cargo too, including tools you added with cargo install, so reinstall those afterwards.

linker cc not found

The package depends on a C compiler and libc6-dev, so this only happens if they were removed later:

sudo apt install build-essential

APT Wants to Remove Other Packages

That is expected for packages built on Ubuntu’s rustc or cargo, such as python3-setuptools-rust or dh-cargo. If you need them, stay with Ubuntu’s toolchain.

Going Back to Ubuntu’s Toolchain

sudo apt remove rust-stable && sudo apt install rustc cargo

Uninstalling

Remove the toolchain and every extra Rust package with:

sudo apt remove 'rust-stable*'

To also remove the repository and key:

sudo rm /etc/apt/sources.list.d/deb.griffo.io.list
sudo rm /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update

APT does not touch ~/.cargo, where the crate cache and your cargo install tools live; remove it yourself if you want a clean slate.

Conclusion

Installing Rust from deb.griffo.io puts the official stable toolchain on Ubuntu, verified and unmodified, with plain rustc and cargo commands for every user and updates through apt upgrade. The whole toolchain stays in step, and musl, WebAssembly, the standard library source and offline docs are all just more packages.

For workstations, shared servers and CI runners that should manage their compiler like everything else on the system, rust-stable is a simple fit.

Frequently Asked Questions

How do I install the latest Rust on Ubuntu?

Add the deb.griffo.io APT repository and its signing key, then run sudo apt install rust-stable. APT keeps the toolchain on the current stable release from then on.

Is it the official Rust build?

Yes. rust-stable repackages the release binaries from static.rust-lang.org, the same ones rustup installs, after verifying the manifest’s signature and every file’s SHA-256.

What is the difference from Ubuntu’s rustc-1.XX packages?

Ubuntu’s versioned packages install commands such as rustc-1.XX next to the default rustc, and stay on whatever version they were published with. rust-stable provides the plain rustc and cargo commands and moves to every new stable release. The versioned packages can stay installed alongside it.

Why is it called rust-stable rather than rustc?

Ubuntu’s Rust packages must all share one exact version, so a newer package that only reused the rustc name would pair a new compiler with an old standard library. rust-stable ships everything as a single unit instead.

How do I add musl or WebAssembly support?

Install rust-stable-std-musl, rust-stable-std-wasm32-unknown-unknown, rust-stable-std-wasm32-wasip1 or rust-stable-std-wasm32-wasip2. These packages take the place of rustup target add.

How do I install Rust on Debian?

Exactly the same way; lsb_release -sc simply resolves to a different codename. There is a companion guide with the Debian specifics: How to install Rust on Debian.

Which Ubuntu releases are supported?

Jammy 22.04 LTS, Noble 24.04 LTS, Questing 25.10 and Resolute 26.04 LTS, on amd64 and arm64. Because the repository line is built from lsb_release -sc, the matching suite is selected for you.

Resources


Disclaimer: The deb.griffo.io repository is an unofficial community project and is not affiliated with the official Debian or Ubuntu projects, or with the Rust Project or the Rust Foundation.