Rust is a systems programming language that combines memory safety with high performance, making it ideal for building command-line tools, web services, embedded systems, and performance-critical applications. Whether you need to develop network services, create WebAssembly modules, or build tools that require C-level speed without manual memory management, Rust provides the safety guarantees and modern tooling to get the job done. By the end of this guide, you will have a working Rust development environment on Fedora, including the compiler, Cargo package manager, and verification that everything works correctly.
Choose Your Rust Installation Method
Fedora offers two primary ways to install Rust, each with different trade-offs for version freshness and update management.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| DNF Package Manager | Fedora Repos | Stable | Automatic via dnf upgrade | Most users who prefer distro-tested packages |
| RustUp Installer | Official Rust | Latest stable | Manual via rustup update | Developers needing newest features or nightly builds |
For most users, the DNF method is recommended because it integrates with Fedora’s package management, receives security updates automatically, and requires no additional maintenance. Choose RustUp if you need the absolute latest Rust version, want to switch between stable/beta/nightly toolchains, or require cross-compilation targets that the Fedora package does not include.
Method 1: Install Rust via DNF
Update Fedora Packages
First, update your system to ensure all existing packages are current. This minimizes potential dependency conflicts during installation:
sudo dnf upgrade --refresh
Install Rust via DNF
Next, install Rust and Cargo using DNF:
sudo dnf install rust cargo
This command installs several key components of the Rust programming environment:
- rustc: The Rust compiler, essential for converting your Rust code into executable binaries.
- Standard Library: Additionally, this provides a collection of standard functionalities and types, crucial for Rust programming.
- rustdoc: Furthermore, this documentation generator helps you create documentation for your Rust code.
- Cargo: Finally, Rust’s package manager and build system streamlines the process of managing dependencies and building your Rust projects.
After installation completes, verify that Rust is accessible by checking the installed version:
rustc --version
Expected output:
rustc 1.x.x (hash date) (Fedora 1.x.x-x.fcNN)
Similarly, confirm that Cargo is available:
cargo --version
Expected output:
cargo 1.x.x (hash date) (Fedora 1.x.x-x.fcNN)
With Rust installed via DNF, your Fedora system is now ready for Rust development. As a result, updates will arrive automatically through regular system upgrades.
Method 2: Install Rust via RustUp
Install Build Dependencies
RustUp requires build tools to compile Rust crates that include native code. Install the necessary development packages:
sudo dnf install curl gcc make -y
This installs curl to download the installer script, plus gcc and make for compiling crates with C dependencies. In addition, if you work with projects that use CMake build systems or need LLVM-based tooling, you can optionally add cmake and clang to the install command.
Download and Run RustUp Installer
With the necessary packages in place, download and run the official RustUp installer script:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This command fetches the RustUp script securely using HTTPS and TLS 1.2, then runs the installer. During installation, you will see the following prompt:
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>
Press 1 or Enter to proceed with the default installation, which installs the stable toolchain.
The installation typically takes 1 to 5 minutes, depending on your internet connection speed. Once complete, you will see:
stable-x86_64-unknown-linux-gnu installed - rustc 1.x.x (hash date) Rust is installed now. Great! To get started you may need to restart your current shell. This would reload your PATH environment variable to include Cargo's bin directory ($HOME/.cargo/bin). To configure your current shell, run: source "$HOME/.cargo/env"
After installation completes, activate the Rust environment in your current shell:
source ~/.cargo/env
This command configures your shell environment to access Rust’s tools and utilities.
Then, verify the installation by checking the Rust compiler version:
rustc --version
Expected output:
rustc 1.x.x (hash date)
The
source ~/.cargo/envcommand only affects your current terminal session. However, RustUp automatically adds the necessary PATH configuration to your shell startup file (~/.bashrcfor Bash or~/.zshrcfor Zsh), so new terminal windows will have Rust available without manual sourcing.
Manage Rust Installation
Update Rust
Regularly updating Rust ensures you have the latest features and security patches. The update method depends on how you installed Rust.
For DNF installations: Updates arrive automatically with your regular system upgrades:
sudo dnf upgrade --refresh
For RustUp installations: Use the built-in update command to fetch the latest toolchain:
rustup update
Expected output showing the update progress:
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2025-xx-xx, rust version 1.x.x (hash date) info: downloading component 'cargo' info: downloading component 'rust-std' info: downloading component 'rustc' info: installing component 'cargo' info: installing component 'rust-std' info: installing component 'rustc' stable-x86_64-unknown-linux-gnu updated - rustc 1.x.x (hash date) info: cleaning up downloads & tmp directories
After updating via RustUp, verify the new version:
rustc --version
Remove Rust
For DNF installations: Remove the main packages and clean up orphaned dependencies:
sudo dnf remove rust cargo
sudo dnf autoremove
The autoremove command cleans up dependencies that were installed with Rust, including build tools like rust-std-static, llvm-libs, and related libraries. Consequently, verify removal with:
rpm -q rust cargo
Expected output confirming removal:
package rust is not installed package cargo is not installed
For RustUp installations: In contrast, use the built-in uninstall command which cleanly removes Rust, Cargo, and all toolchains:
rustup self uninstall
You will see a confirmation prompt:
Thanks for hacking in Rust! This will uninstall all Rust toolchains and data, and remove $HOME/.cargo/bin from your PATH environment variable. Continue? (y/N) y info: removing rustup home info: removing cargo home info: removing rustup binaries info: rustup is uninstalled
Moreover, the uninstall process removes the ~/.cargo and ~/.rustup directories, along with the PATH modifications in your shell configuration.
Troubleshooting
Command Not Found After RustUp Installation
If you see rustc: command not found after installing via RustUp, your shell has not loaded the PATH changes. Run:
source ~/.cargo/env
Alternatively, close and reopen your terminal window. If the problem persists, verify that RustUp added the PATH configuration to your shell startup file:
grep -r cargo ~/.bashrc ~/.zshrc ~/.profile 2>/dev/null
Expected output showing RustUp added the PATH configuration:
/home/username/.bashrc:. "$HOME/.cargo/env"
Otherwise, if no output appears, add this line manually to your ~/.bashrc (for Bash) or ~/.zshrc (for Zsh):
. "$HOME/.cargo/env"
Linker Errors When Building Crates
If you encounter linker errors like error: linker 'cc' not found when building Rust projects, you need to install build tools:
sudo dnf install gcc make
Additionally, some crates require additional development libraries. For example, crates using OpenSSL need:
sudo dnf install openssl-devel
Conflicting Rust Installations
If you have both DNF-installed Rust and RustUp installed, you may encounter version conflicts or unexpected behavior. Check which Rust is active:
which rustc
RustUp installation:
/home/username/.cargo/bin/rustc
DNF installation:
/usr/bin/rustc
Therefore, to avoid conflicts, use only one installation method. Remove the DNF packages if you prefer RustUp, or uninstall RustUp if you prefer the system packages.
Conclusion
You now have Rust configured on Fedora with either the DNF package or the RustUp installer. The DNF method provides automatic updates through system upgrades, while RustUp gives you direct control over toolchain versions and access to nightly builds. From here, explore Git on Fedora for version control, set up Docker on Fedora for containerized builds and CI/CD workflows, or consider VSCodium as a lightweight editor with excellent Rust support through the rust-analyzer extension.
Congratulations for the excellent website and useful guides. For install Rust+cargo I use the default script: curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh. Alternatively in Fedora i use in the terminal:
# Rust
sudo dnf in -y rustup
rustup-init -y
# Completions for Fish – For other shell see: https://rust-lang.github.io/rustup/installation/index.html
mkdir -p ~/.config/fish/completions && rustup completions fish > ~/.config/fish/completions/rustup.fish
Thanks for the feedback and the alternative installation methods! Both the rustup.rs script and the DNF approach are great options. I appreciate you sharing the Fish shell completions tip as well. It’s always helpful to have multiple ways to set up Rust on Fedora. Thanks again for contributing!