Install Rust on Linux Mint 21 or 20: A Straight‑Line Guide
If you’re trying to get your Rust setup running on Linux Mint 20 or Mint 21, this is the quick route that skips the unnecessary detours.
Prerequisites
Before we fire up rustup, make sure you have a recent X86‑64 kernel (Mint 20/21 ships with 5.10+). You’ll also need a handful of build tools:
sudo apt update && sudo apt install -y build-essential curl git
build-essential pulls in gcc, make, and other stuff Rust’s compiler will chew on.
I’ve seen people try to compile a project without it and end up staring at a wall‑of‑errors that look like an alien language.
Using rustup (the recommended way)
Rust’s official installer is called rustup; it keeps your toolchain tidy and lets you switch versions on the fly.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
During the run, answer “yes” to install.
When it finishes, add Rust’s bin directory to your shell profile:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.profile source ~/.profile
Now check that you’re actually talking to the right compiler:
rustc --version # e.g., rustc 1.69.0 (8e60cbf06 2023-04-26)
If rustc responds, congratulations—Rust is installed.
Installing from APT (quick but stale)
Some people prefer the package manager route:
sudo apt install -y rustc cargo
This pulls in a very old release (often 1.50 or earlier).
I’ve seen projects that compile with rustc 1.50 crash because they rely on features only added in later editions.
Unless you’re working on legacy code, stick with rustup.
Verifying the install and setting up a project
Create a toy project to confirm everything is wired:
cargo new hello_world cd hello_world cargo run
You should see Hello, world! printed without hiccups.
If you hit an error like “cannot find crate serde,” that’s usually because you’re missing the registry or your .cargo/registry is corrupted. In those cases, a quick clean solves it:
cargo clean --release
Common pitfalls and how to dodge them
- Missing build tools – Without build-essential, even rustc --version will complain about missing headers.
- Out‑of‑date rustup – Occasionally, the installer falls back on an older bootstrap. Run rustup update to bring it to the latest stable.
- Wrong PATH order – If you installed Rust via APT and then rustup, the shell might still pick up the old binary first. Make sure $HOME/.cargo/bin comes before /usr/lib/rustlib.
That’s it. You’ve got a fully functioning Rust toolchain on Linux Mint 20 or 21, ready for whatever you throw at it.