How to install Rust on Fedora or Red Hat Enterprise Linux

Rust development on Red Hat-family Linux needs the Rust compiler, Cargo, and a system linker before local projects can build. Fedora, CentOS Stream, and Red Hat Enterprise Linux provide those pieces through DNF or YUM packages, so the toolchain follows the operating system's update and dependency rules.

On RHEL 9 and RHEL 10, Red Hat ships Rust as Rust Toolset through the rust-toolset package. Fedora and CentOS Stream expose Rust and Cargo as direct rust and cargo packages, while RHEL 8 still uses the rust-toolset module through YUM.

The distro package path fits hosts that need administrator-controlled software and OS-supported updates. Version checks confirm that rustc and cargo resolve on the shell path, and a throwaway Cargo project confirms that the linker and default project template can build a real binary.

Steps to install the Rust toolchain on Fedora or RHEL:

  1. Open a terminal with sudo privileges.
  2. Install Rust Toolset on RHEL 9 or RHEL 10.
    $ sudo dnf install rust-toolset
    Updating Subscription Management repositories.
    Dependencies resolved.
    ================================================================================
     Package          Arch     Version       Repository       Size
    ================================================================================
    Installing:
     rust-toolset     noarch   1.92.0-1.el9  rhel-appstream   20 k
    Installing dependencies:
     cargo            x86_64   1.92.0-1.el9  rhel-appstream  8.1 M
     gcc              x86_64   11.5.0-14.el9 rhel-appstream   30 M
     rust             x86_64   1.92.0-1.el9  rhel-appstream   28 M
     rust-std-static  x86_64   1.92.0-1.el9  rhel-appstream   40 M
    ##### snipped #####
    Complete!

    On Fedora or CentOS Stream, use sudo dnf install rust cargo. On RHEL 8, use sudo yum module install rust-toolset.

  3. Check the Rust compiler version.
    $ rustc --version
    rustc 1.92.0 (ded5c06cf 2025-12-08) (Red Hat 1.92.0-1.el9)

    Fedora reports a Fedora package suffix instead of a Red Hat suffix. The exact Rust version changes as the distribution packages are updated.

  4. Check the Cargo version.
    $ cargo --version
    cargo 1.92.0 (344c4567c 2025-10-21) (Red Hat 1.92.0-1.el9)
  5. Create a sample Cargo project.
    $ cargo new hello-rust
        Creating binary (application) `hello-rust` package
    note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
  6. Run the sample project through Cargo.
    $ cargo run --manifest-path hello-rust/Cargo.toml
       Compiling hello-rust v0.1.0 (/home/user/hello-rust)
        Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s
         Running `hello-rust/target/debug/hello-rust`
    Hello, world!
  7. Remove the sample project.
    $ rm -r hello-rust

    This removes only the throwaway verification project. It does not remove Rust Toolset, Cargo, or the installed Rust packages.