How to Install Rust on Debian: The Official Stable Toolchain Through APT
Rust is a systems programming language built around speed, memory safety and fearless concurrency. It ships a new stable release every six weeks, and the ecosystem moves with it: crates adopt newly stabilised language features and library APIs quickly, and a crate that declares a newer rust-version simply refuses to build with an older compiler.
Debian packages Rust as rustc and cargo, and a stable release freezes them: Trixie is on rustc 1.85, and every six weeks it falls one more release behind. The usual escape is rustup, which installs the official toolchain into each user’s ~/.rustup and updates it with rustup update. That works well on a personal laptop, but it means a separate toolchain per user, and a second update mechanism next to APT.
The unofficial deb.griffo.io repository offers a third way: the package rust-stable, which contains the official Rust stable toolchain, the very same binaries rustup downloads from static.rust-lang.org, installed once for the whole system and upgraded with apt upgrade on every stable release.
Install the Latest Rust on Debian: The Short Version
If you only came for the commands, this adds the repository and installs the latest Rust toolchain on Debian:
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 explains what the package contains, what it replaces, how to add extra targets such as musl and WebAssembly, and what to check when something goes wrong.
What You Get With rust-stable
- 🦀 The whole toolchain -
rustc,cargo,rustdoc,rustfmt(cargo fmt),clippy(cargo clippy),rust-analyzer, therust-gdbandrust-lldbwrappers, and the standard library for your machine, all from the same release. - 🔏 Verified official binaries - Every build checks the release manifest’s GPG signature against the Rust release signing key, then each tarball’s SHA-256 against that manifest. The binaries are installed byte for byte, with no rebuilding or patching.
- 👥 One install for every user - A single system-wide toolchain instead of a
~/.rustupin every home directory. - 🧩 Kept together, never mixed - The compiler, cargo, the standard library, clippy and rustfmt always move together, so a new compiler never meets an old standard library.
- 🎯 Extra targets as packages - Static Linux binaries through
rust-stable-std-musl, and WebAssembly throughwasm32-unknown-unknown,wasm32-wasip1andwasm32-wasip2packages. - 📚 Source and offline docs -
rust-stable-srcfor rust-analyzer, andrust-stable-docfor The Book, the std API docs and the Cargo book on disk.
Why Use the deb.griffo.io Repository?
- Current stable Rust through APT, updated within hours of each upstream release, every six weeks plus point releases.
- The official build, not a rebuild: 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 SHA-256 sums. - System-wide and tidy: the toolchain lives under
/usr/lib/rust-stablewith its own bundled LLVM, and the commands are linked into/usr/bin, so every user has them onPATHwith no shell profile changes. - Ready to build immediately: the package depends on a C compiler (gcc or clang) and
libc6-dev, which rustc uses for linking, socargo buildworks straight after the install. - Man pages and completions: cargo’s man pages and its bash and zsh completions come with it.
- Works across supported Debian releases on amd64 and arm64, with the codename detected automatically.
Prerequisites
Before you start, make sure you have:
- A Debian-based system (Bookworm 12, Trixie 13, Forky 14, or Sid)
- An amd64 or arm64 machine (including a Raspberry Pi 4 or 5 on a 64-bit OS)
sudoprivilegescurlinstalled (sudo apt install curlif needed)- Some disk space: the main package is about 680 MB installed, and each extra target adds between 100 and 230 MB
Upstream also publishes toolchains for armhf, i386 and several other architectures, but they are not packaged here; use rustup on those machines.
Step 1: Add the deb.griffo.io Repository
Add the signing 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
What each command does:
- Create the keyrings directory - ensures
/etc/apt/keyringsexists with proper permissions. - Install the GPG key - downloads the repository key and de-armours it into a dedicated keyring for verification.
- Add the repository - writes a
signed-bysource line, withlsb_release -scsupplying your Debian codename. - Update the package list - refreshes APT so it knows about the new packages.
Step 2: Update the Package List
If you skipped the last line, run the update now:
sudo apt update
Then check what is on offer:
apt policy rust-stable
The candidate should point at https://deb.griffo.io/apt.
Step 3: Install rust-stable
Install the toolchain:
sudo apt install rust-stable
APT also installs rust-stable-src by default, since it is a recommended package and rust-analyzer needs it to navigate into the standard library.
Why the Package Is Called rust-stable, and What It Replaces
Debian splits Rust into a family of packages (rustc, cargo, libstd-rust-dev, rustfmt, rust-clippy and more) that must all have exactly the same version. A newer package that only reused the name rustc would leave Debian’s older standard library next to a newer compiler, and every build would fail. So the whole toolchain ships as one package, rust-stable, and it takes the place of the packages that own the same commands.
rust-stable replaces Debian’s rustc, cargo, rustfmt, rust-clippy, rust-gdb, rust-lldb, rust-analyzer and rustup packages, plus their *-web variants. APT lists what it is about to remove and asks first. Packages that depend on Debian’s compiler, such as python3-setuptools-rust or dh-cargo, are removed with them. The system LLVM and clang are not touched, and nothing on a running system needs the compiler, so this only affects Rust development tooling.
Step 4: Verify the Installation
Confirm the versions:
rustc --version
cargo --version
You should see output similar to:
rustc 1.100.1 (...)
cargo 1.100.1 (...)
Check that the other tools are there too:
cargo clippy --version
rustfmt --version
rust-analyzer --version
Getting Started with Rust
Your First Project
Create, build and run a project with cargo:
cargo new hello
cd hello
cargo run
cargo new writes a Cargo.toml and a src/main.rs, and cargo run compiles it and runs the result:
Compiling hello v0.1.0 (/home/you/hello)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.40s
Running `target/debug/hello`
Hello, world!
A release build, with optimisations, goes into target/release/:
cargo build --release
Linting, Formatting and Testing
clippy and rustfmt are part of the package, so the usual quality loop works out of the box:
# Catch common mistakes and unidiomatic code
cargo clippy
# Format the whole project
cargo fmt
# Run unit, integration and doc tests
cargo test
# Build the API docs for your crate and its dependencies, then open them
cargo doc --open
Adding Dependencies
cargo add edits Cargo.toml for you:
cargo add serde --features derive
cargo add anyhow
cargo build
Dependencies are downloaded from crates.io into ~/.cargo/registry, per user, exactly as with rustup.
Installing Tools With cargo install
cargo install still works and places binaries in ~/.cargo/bin. A system-wide toolchain does not touch your shell profile, so add that directory to PATH yourself if it is not there already:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
Static Binaries With musl
A binary linked against musl has no runtime dependency on glibc, so it runs on any Linux of the same architecture. Add the musl standard library as a package (it brings its own musl, so musl-tools is not needed):
sudo apt install rust-stable-std-musl
# x86_64-unknown-linux-musl on amd64, aarch64-unknown-linux-musl on arm64
cargo build --release --target x86_64-unknown-linux-musl
# ldd confirms the result needs no shared libraries
ldd target/x86_64-unknown-linux-musl/release/hello
WebAssembly
Each WebAssembly target is its own package:
# Browser WebAssembly: 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-wasip1
This replaces rustup target add: with the packaged toolchain, a target is an apt install away.
Editors, Debuggers and Offline Docs
- Editors: rust-analyzer is in
/usr/bin, so any editor with a language server client (Neovim, Helix and others) can start it with no extra download.rust-stable-srclets it jump into the standard library. - Debuggers:
rust-gdbandrust-lldbstart gdb or lldb with Rust’s pretty-printers loaded, so Rust types display readably. Installgdborlldbseparately. - Offline docs:
sudo apt install rust-stable-docputs the std API docs, The Book, Rust by Example, the Cargo book and the reference under/usr/share/doc/rust-stable-doc/html. It is large (about 760 MB), so it is only suggested, never installed automatically.
rustup Habits That Do Not Apply
There is no rustup in this setup, so a few commands change:
rustup updatebecomessudo apt update && sudo apt upgrade.rustup target addbecomessudo apt install rust-stable-std-<target>.rustup component add rust-srcbecomessudo apt install rust-stable-src.- A project’s
rust-toolchain.tomlis a rustup feature, so it has no effect here.
If you need nightly, a pinned older toolchain, or a target that is not packaged, use rustup instead of this package.
Keeping Rust Updated
Because Rust arrived via APT, updates come with the rest of the system:
sudo apt update && sudo apt upgrade
Every new stable release, and every point release, reaches you this way, and the toolchain, the standard library and any extra targets you installed move forward together.
Other Tools from deb.griffo.io
The repository packages plenty of tools that fit naturally alongside Rust:
- Zig - a general-purpose language and toolchain, also packaged here as a stable release.
- Helix - a modal terminal editor with built-in language server support, ready for rust-analyzer.
- Zed - a fast code editor, itself written in Rust.
- Neovim - the extensible Vim-based editor with a built-in language server client.
- just - a command runner, written in Rust, for keeping project tasks in one place.
Troubleshooting
GPG or Key Errors
If APT reports an unsigned repository or an invalid key, import it again:
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 see the rust-stable package:
- Re-run
sudo apt updateafter adding the repository. - Confirm your release is supported (Bookworm, Trixie, Forky, or Sid).
- Confirm your architecture is amd64 or arm64 with
dpkg --print-architecture. - Inspect the source list:
cat /etc/apt/sources.list.d/deb.griffo.io.list.
Remember the name: apt install rust or apt install rustc will not get you this toolchain.
rustc Still Reports an Old Version
Another rustc is probably earlier on your PATH, typically rustup’s proxies in ~/.cargo/bin:
which -a rustc cargo
If ~/.cargo/bin/rustc comes first, either remove rustup with rustup self uninstall (this also deletes ~/.rustup), or keep it and accept that rustup’s toolchain takes priority for your user. Binaries you installed with cargo install are separate files in ~/.cargo/bin and are not affected by this choice, but rustup self uninstall removes that directory, so reinstall them afterwards.
linker cc not found
rust-stable depends on a C compiler and libc6-dev, so this should not happen after a normal install. If you removed them later, put them back:
sudo apt install build-essential
APT Wants to Remove Other Packages
Removing python3-setuptools-rust, dh-cargo or similar packages is expected: they depend on Debian’s rustc or cargo, which rust-stable replaces. If you need them, keep Debian’s toolchain instead.
Going Back to Debian’s Toolchain
sudo apt remove rust-stable && sudo apt install rustc cargo
Uninstalling
Remove the toolchain and any extra targets with:
sudo apt remove 'rust-stable*'
To also drop 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
Your ~/.cargo directory, with the registry cache and any tools from cargo install, is left in place.
Conclusion
Installing Rust from deb.griffo.io gives Debian users the official stable toolchain, verified and unmodified, installed once for every user and kept current by apt upgrade. The compiler, cargo, clippy, rustfmt and rust-analyzer always come from the same release, and musl, WebAssembly, the standard library source and the offline docs are each a package away.
If you work on stable Rust and want your compiler managed like the rest of your system, on a workstation, a shared server or a CI runner, rust-stable keeps it simple.
Frequently Asked Questions
How do I install the latest Rust on Debian?
Add the deb.griffo.io APT repository and its signing key, then run sudo apt install rust-stable. You get the current official stable toolchain, updated by APT on every release.
Is this the same Rust that rustup installs?
Yes. The package contains the official release binaries from static.rust-lang.org, the same files rustup downloads, checked against the Rust release signing key and the manifest’s SHA-256 sums and installed unmodified.
Why is the package called rust-stable and not rustc?
Because Debian’s Rust packages must all share exactly the same version. Reusing only the rustc name would pair a new compiler with Debian’s old standard library. rust-stable ships the whole toolchain as one unit and replaces Debian’s rustc, cargo and related packages.
Can I use rustup and rust-stable together?
rust-stable replaces Debian’s rustup package. A rustup installed with its own script lives in ~/.cargo/bin and takes priority for your user if that directory comes first on PATH. Pick one per user to avoid confusion.
How do I add the musl or WebAssembly targets?
Install them as packages: rust-stable-std-musl, rust-stable-std-wasm32-unknown-unknown, rust-stable-std-wasm32-wasip1 or rust-stable-std-wasm32-wasip2. They replace rustup target add.
How do I install Rust on Ubuntu?
Exactly the same way; lsb_release -sc simply resolves to a different codename. There is a companion guide with the Ubuntu specifics: How to install Rust on Ubuntu.
Which Debian releases are supported?
Bookworm 12, Trixie 13, Forky 14 and Sid, on amd64 and arm64. Because the repository line is built from lsb_release -sc, the matching suite is selected for you.
Resources
- Rust Website
- Rust Documentation
- Rust GitHub Repository
- rust-stable Packaging Repository
- deb.griffo.io Repository
- Install guide on deb.griffo.io
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.