Chapter 1. Rust

1.1. About Rust Toolset

Rust Toolset is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. It provides the Rust programming language compiler rustc, the Cargo build tool and dependency manager, the rustfmt tool, and required libraries. The cargo-vendor package is now built into the cargo command, but its usage remains the same.

Rust Toolset is distributed as a part of Red Hat Developer Tools for Red Hat Enterprise Linux 7 and is available as a module in Red Hat Enterprise Linux 8.

The following components are available as a part of Rust Toolset:

Table 1.1. Rust Components

NameVersionDescription

rust

1.43.0

The Rust compiler front-end for LLVM.

cargo

1.43.0

A build system and dependency manager for Rust.

rustfmt

1.43.0

A tool for automatic formatting of Rust code.

1.2. Compatibility

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

  • The 64-bit Intel and AMD architectures
  • The 64-bit ARM architecture
  • The IBM Power Systems architecture
  • The little-endian variant of IBM Power Systems architecture
  • The IBM Z Systems architecture

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

This chapter lists the steps to perform before installing Rust Toolset on a Red Hat Enterprise Linux 7 system. Complete the following steps to attach a subscription that provides access to the repository for Red Hat Developer Tools, and then enable the Red Hat Developer Tools and Red Hat Software Collections repositories.

Prerequisites

  • Verify that wget is installed on your system. The tool is available from the default Red Hat Enterprise Linux repositories. To install it, run the following command as root:

    # yum install wget

Procedure

  1. Get the latest subscription data from the server:

    # subscription-manager refresh
  2. Use the following command to register the system:

    # subscription-manager register

    You can also register the system by following the appropriate steps in Registering and Unregistering a System in the Red Hat Subscription Management document.

  3. Display a list of all subscriptions that are available for your system and identify the pool ID for the subscription:

    # subscription-manager list --available

    This command displays the subscription name, unique identifier, expiration date, and other details related to it. The pool ID is listed on a line beginning with Pool ID.

  4. Attach the subscription that provides access to the Red Hat Developer Tools repository. Use the pool ID you identified in the previous step.

    # subscription-manager attach --pool=<appropriate pool ID from the subscription>
  5. Verify the list of subscriptions attached to your system:

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

    # subscription-manager repos --enable rhel-7-variant-devtools-rpms

    Replace variant with the Red Hat Enterprise Linux system variant (server or workstation).

    Consider using Red Hat Enterprise Linux Server to access the widest range of the development tools.

  7. Enable the rhel-variant-rhscl-7-rpms repository:

    # subscription-manager repos --enable rhel-variant-rhscl-7-rpms

    Replace variant with the Red Hat Enterprise Linux system variant (server or workstation).

  8. Add the Red Hat Developer Tools GPG key to your system:

    # 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

Once the subscription is attached to the system and the repositories are enabled, install Rust Toolset as described in Section 1.4, “Installing Rust Toolset”.

Additional resources

  • For more information on how to register your system using Red Hat Subscription Management and associate it with subscriptions, see the Red Hat Subscription Management collection of guides.

1.4. Installing Rust Toolset

Complete the following steps to install Rust Toolset on a Red Hat Enterprise Linux system.

Note

A valid subscription that provides access to the Red Hat Developer Tools content set is required to install Rust Toolset on a Red Hat Enterprise Linux 7 system. For detailed instructions on how to associate your Red Hat Enterprise Linux 7 system with an appropriate subscription and get access to Rust Toolset, see Section 1.3, “Getting access to Rust Toolset on Red Hat Enterprise Linux 7”.

Important

Before installing Rust Toolset, install all available Red Hat Enterprise Linux updates.

  1. Install all of the components included in Rust Toolset for your operating system:

    • On Red Hat Enterprise Linux 7, install the rust-toolset-1.43 collection:

      # yum install rust-toolset-1.43
    • On Red Hat Enterprise Linux 8, install the rust-toolset module:

      # yum module install rust-toolset

      This installs all development and debugging tools, and other dependent packages to the system. Notably, Rust Toolset has a dependency on LLVM Toolset.

Installable documentation

  • Install The Rust Programming Language book and API documentation in HTML format:

    • On Red Hat Enterprise Linux 7, install the rust-toolset-1.43-rust-doc package:

      # yum install rust-toolset-1.43-rust-doc

      The book is available in /opt/rh/rust-toolset-1.43/root/usr/share/doc/rust/html/index.html

      The API documentation for all crates is available in HTML format in /opt/rh/rust-toolset-1.43/root/usr/share/doc/rust/html/std/index.html.

    • On Red Hat Enterprise Linux 8, install the rust-doc package:

      # yum install rust-doc

      The book is available in /usr/share/doc/rust/html/index.html

      The API documentation for all crates is available in HTML format in /usr/share/doc/rust/html/std/index.html.

Online documentation