Skip to content

Rust

Software stack

Rust is available as a module in DelftBlue software stack:

module load 2022r2
module load rust

Run Rust:

[<netid>@login01 ~]$ rustc --version

rustc 1.51.0

Local installation

If you need more recent version of Rust than the one in the DelftBlue software stack, it is very easy to install this locally. The only thing to be aware of is the destination folders of installation. As the space in your /home directory is limited, it is recommended to install it in the /scratch folder.

Before you start with the following steps make sure you unload the rust-module:

module unload rust

First, export the destination directories:

export CARGO_HOME=/scratch/<netid>/.cargo
export RUSTUP_HOME=/scratch/<netid>/.rustup

and add these two lines also to your .bashrc (or your preferred profile file) so the environment variables will be set at every login.

Second, install Rust as usual:

[<netid>@login01 scratch]$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /scratch/<netid>/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /scratch/<netid>/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /scratch/<netid>/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/<netid>/.profile
  /home/<netid>/.bash_profile
  /home/<netid>/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2022-05-19, rust version 1.61.0 (fe5b13d68 2022-05-18)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 19.7 MiB /  19.7 MiB (100 %) 937.6 KiB/s in 41s ETA:  0s
info: installing component 'rust-std'
 26.9 MiB /  26.9 MiB (100 %)  13.0 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 55.4 MiB /  55.4 MiB (100 %)  15.7 MiB/s in  3s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.61.0 (fe5b13d68 2022-05-18)


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 (/scratch/<netid>/.cargo/bin).

To configure your current shell, run:
source /scratch/<netid>/.cargo/env

Finally, we can source the configuration file and run Rust:

[<netid>@login01 scratch]$ source /scratch/<netid>/.cargo/env

[<netid>@login01 scratch]$ rustc --version

rustc 1.61.0 (fe5b13d68 2022-05-18)

Update locally installed Rust

Once you've installed a local version of Rust it is very easy to keep it updated by simply giving:

rustup update

Uninstall locally installed Rust

rustup self uninstall