How to Install Rust on Fedora Linux
Want a fast, safe systems language on your Fedora box?
This walk‑through shows you how to get the latest stable Rust toolchain with just a few commands, why each step matters, and what to do when things go sideways.
1. Make sure you have a recent kernel and tools
Fedora’s default repositories usually ship a sane GCC version and build‑essential packages, but if your system is older (e.g., Fedora 32 or earlier) you’ll hit “rustc: command not found” even after installation.
sudo dnf groupinstall "Development Tools" -y
Installs compilers, make, cmake, and other build utilities that Rust’s cargo will lean on. Skipping this leaves you with a half‑baked toolchain that can fail during crate compilation.
2. Install the official Rustup installer
Rustup is the de facto way to get Rust; it keeps your compiler, Cargo, and standard library in sync.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Running rustup from the official link guarantees you’re pulling the latest installer script and not some older mirror that might miss a recent patch or security fix.
When prompted, pick “1” for the default installation. It adds Rust to your $HOME/.cargo/bin. Add it to your shell if it doesn’t automatically:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.profile source ~/.profile
3. Verify everything is wired up
rustc --version cargo --version
You should see something like rustc 1.76.0 and a matching Cargo version. If either command fails, you probably didn’t reload your profile or the $PATH entry is wrong.
4. Install additional Fedora packages for Rust projects
Many libraries rely on system‑wide libraries; without them, compile‑time errors can bite hard.
sudo dnf install openssl-devel libffi-devel zlib-devel
Real‑world note: I’ve seen people run into “failed to link against OpenSSL” after a kernel update that bumped the openssl package. Installing the -devel package pulls in headers and libs so Rust can build bindings.
5. (Optional) Switch to a nightly toolchain
If you’re hacking on cutting‑edge features or testing compiler experiments:
rustup install nightly rustup default nightly
Nightly gives you access to unstable language traits, but it also brings the risk of breaking crates that depend on stable ABI. Stick with stable unless you need a specific feature.
6. Test your setup
Create a trivial “Hello” program:
cargo new hello_world cd hello_world cargo run
You should see Hello, world! printed out. If cargo pulls crates from the internet or fails to compile, double‑check that your firewall isn’t blocking GitHub or Cargo’s registry.
7. Keep Rust up to date
rustup update
This refreshes both rustc and all installed toolchains, plus Cargo itself.
That’s it. You’ve got a fully functional Rust environment on Fedora, ready for projects ranging from CLI utilities to low‑level OS work.