Install Rust on Rocky Linux

Enable the right repos

Rocky Linux keeps many developer tools in extra repositories, so enable EPEL before you install Rust.

The EPEL note is simple. With EPEL enabled, dnf can see the Rust packages and resolve their dependencies without manual work.

On a fresh server install this one time enable step saves a lot of troubleshooting later.

Install with dnf

Install the rustup package with dnf for a managed toolchain, or install the rust package where only the compiler is needed.

Both package names are generic across Rocky releases, so pick rustup when you want updates through the rustup command.

sudo dnf install rustup

Rust toolchain installed successfully

As plain text, the alternative is the install rust form of the same dnf command for a compiler only setup.

rustc --version check

Confirm the install by asking the compiler for its version in a new shell.

rustc --version

rustc 1.75.0 (ad2397f6f 2023-12-28) (x86_64-unknown-linux-gnu)

A version reply means the compiler is on the PATH and ready to build a test crate.

Version notes

Distribution packages favor stability over freshness, so the dnf version can trail the latest stable release.

When you need newer features, run the rustup update command as plain text after installing the rustup package. Check the version again to confirm the upgrade.

The code on this page was not run: it needs Rocky Linux and root.

Article author: Arthur Isaev