Chapter 1. Rust Toolset

Rust Toolset is a Red Hat offering for developers on Red Hat Enterprise Linux (RHEL). It provides the rustc compiler for the Rust programming language, the Rust package manager Cargo, the rustfmt formatting tool, and required libraries.

Rust Toolset is distributed as a part of Red Hat Developer Tools for Red Hat Enterprise Linux 7. For Red Hat Enterprise Linux 8, Rust Toolset is available as a module. Rust Toolset is available as packages for Red Hat Enterprise Linux 9.

1.1. Rust Toolset components

The following components are available as part of Rust Toolset:

NameVersionDescription

rust

1.66.1

The Rust compiler front-end for LLVM.

cargo

1.66.1

A build system and dependency manager for Rust.

rustfmt

1.66.1

A tool for automatic formatting of Rust code.

1.2. Rust Toolset compatibility

Rust Toolset is available for Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8 and Red Hat Enterprise Linux 9 on the following architectures:

  • AMD and Intel 64-bit
  • 64-bit ARM (RHEL 8 and RHEL 9)
  • IBM Power Systems, Little Endian
  • IBM Power Systems, Big Endian (Only RHEL 7)
  • 64-bit IBM Z

1.3. Getting access to Rust Toolset on Red Hat Enterprise Linux 7

To be able to install Rust Toolset on Red Hat Enterprise Linux 7, you must access and enable Red Hat Developer Tools and Red Hat Software Collections repositories.
If these repositories are already attached to your system, see Installing Rust Toolset.

Procedure

  1. Install Wget by running:

    # yum install wget
  2. Download the latest subscription data by running:

    # subscription-manager refresh
  3. Register your system by running:

    # subscription-manager register

    To register your system using a graphical user interface (GUI), follow the Registering and Unregistering a System guide.

  4. Display a list of all available subscriptions and identify the pool ID by running:

    # subscription-manager list --available
  5. Find the pool ID on the line beginning with Pool ID.
  6. Attach the subscription that provides access to the Red Hat Developer Tools repository to your system by running:

    # subscription-manager attach --pool=<pool ID from the subscription>
    • Replace <pool ID from the subscription> with the pool ID you identified in the previous step.
  7. Verify which subscriptions are attached to your system by running:

    # sudo subscription-manager list --consumed
  8. Enable the rhel-7-variant-devtools-rpms repository by running:

    # subscription-manager repos --enable rhel-7-<variant>-devtools-rpms
    • Replace <variant> with your Red Hat Enterprise Linux system variant: server or workstation.

      Use server to access the widest range of development tools.

  9. Enable the rhel-variant-rhscl-7-rpms repository by running:

    # subscription-manager repos --enable rhel-<variant>-rhscl-7-rpms
    • Replace <variant> with your Red Hat Enterprise Linux system variant: server or workstation.
  10. Add the Red Hat Developer Tools GPG key to your system by running:

    # cd /etc/pki/rpm-gpg
    # wget -O RPM-GPG-KEY-redhat-devel https://www.redhat.com/security/data/a5787476.txt
    # rpm --import RPM-GPG-KEY-redhat-devel

Additional resources

1.4. Installing Rust Toolset

Complete the following steps to install Rust Toolset including all development and debugging tools as well as dependent packages. Note that Rust Toolset has a dependency on LLVM Toolset.

Prerequisites

Procedure

On Red Hat Enterprise Linux 7, install the rust-toolset-1.66 collection by running:

# yum install rust-toolset-1.66

On Red Hat Enterprise Linux 8, install the rust-toolset module by running:

# yum module install rust-toolset

On Red Hat Enterprise Linux 9, install the rust-toolset package by running:

# dnf install rust-toolset

1.5. Installing Rust documentation

The The Rust Programming Language book is available as installable documentation.

Prerequisites

Procedure

To install the rust-doc package, run the following command:

  • On Red Hat Enterprise Linux 7:

    # yum install rust-toolset-1.66-rust-doc

    You can find the The Rust Programming Language book under the following path: /opt/rh/rust-toolset-1.66/root/usr/share/doc/rust/html/index.html.
    You can find the API documentation for all Rust code packages under the following path: /opt/rh/rust-toolset-1.66/root/usr/share/doc/rust/html/std/index.html.

  • On Red Hat Enterprise Linux 8:

    # yum install rust-doc

    You can find the The Rust Programming Language book under the following path: /usr/share/doc/rust/html/index.html.
    You can find the API documentation for all Rust code packages under the following path: /usr/share/doc/rust/html/std/index.html.

  • On Red Hat Enterprise Linux 9:

    # dnf install rust-doc

    You can find the The Rust Programming Language book under the following path: /usr/share/doc/rust/html/index.html.
    You can find the API documentation for all Rust code packages under the following path: /usr/share/doc/rust/html/std/index.html.

1.6. Installing Cargo documentation

The Cargo, Rust’s Package Manager book is available as installable documentation for Cargo.

Note

From Rust Toolset 1.66, the cargo-doc package is included in the rust-doc package.

Prerequisites

Procedure

  • To install the cargo-doc package, run:

    • On Red Hat Enterprise Linux 7:

      # yum install rust-toolset-1.66-cargo-doc

      You can find the Cargo book under the following path: /opt/rh/rust-toolset-1.66/root/usr/share/doc/cargo/html/index.html.

    • On Red Hat Enterprise Linux 8:

      # yum install cargo-doc

      You can find the Cargo, Rust’s Package Manager book under the following path: /usr/share/doc/cargo/html/index.html.

    • On Red Hat Enterprise Linux 9:

      # dnf install cargo-doc

      You can find the Cargo, Rust’s Package Manager book under the following path: /usr/share/doc/cargo/html/index.html.

1.7. Additional resources