Install Rust on Fedora 36

This guide will take you through how to install Rust on Fedora 36. Rust is a general-purpose programming language with a focus on performance, type safety, and concurrency. Rust ensures memory safety, so all references point to usable memory without the need for a garbage collector or reference counting, both of which are necessary for other memory-safe languages.

How to Install Rust on Fedora 36

  • Update your system packages using the command below.
sudo dnf update
  • Next, install dependencies such as curl, etc.
sudo dnf install cmake gcc make curl clang -y

Sample output

Dependencies resolved.
==============================================================================
 Package                      Arch      Version              Repository  Size
==============================================================================
Installing:
 clang                        x86_64    14.0.5-1.fc36        updates     82 k
 cmake                        x86_64    3.22.2-1.fc36        fedora     6.3 M
Upgrading:
 cpp                          x86_64    12.2.1-1.fc36        updates     11 M
 gcc                          x86_64    12.2.1-1.fc36        updates     33 M
 gcc-gdb-plugin               x86_64    12.2.1-1.fc36        updates    136 k
 libgcc                       x86_64    12.2.1-1.fc36        updates    107 k
 libgomp                      x86_64    12.2.1-1.fc36        updates    293 k
 libstdc++                    x86_64    12.2.1-1.fc36        updates    778 k
Installing dependencies:
 clang-libs                   x86_64    14.0.5-1.fc36        updates     22 M
 clang-resource-filesystem    x86_64    14.0.5-1.fc36        updates     12 k
 cmake-data                   noarch    3.22.2-1.fc36        fedora     1.6 M
 cmake-filesystem             x86_64    3.22.2-1.fc36        fedora      18 k
 cmake-rpm-macros             noarch    3.22.2-1.fc36        fedora      17 k
 gcc-c++                      x86_64    12.2.1-1.fc36        updates     13 M
 jsoncpp                      x86_64    1.9.5-2.fc36         fedora      98 k
 libstdc++-devel              x86_64    12.2.1-1.fc36        updates    2.4 M
 rhash                        x86_64    1.4.2-2.fc36         fedora     185 k
 vim-filesystem               noarch    2:9.0.246-1.fc36     updates     20 k
Installing weak dependencies:
 compiler-rt                  x86_64    14.0.5-1.fc36        updates    2.7 M
 libomp                       x86_64    14.0.5-1.fc36        updates    938 k
 libomp-devel                 x86_64    14.0.5-1.fc36        updates     29 k

Transaction Summary
==============================================================================
Install  15 Packages
Upgrade   6 Packages

Total download size: 94 M
Downloading Packages:
  • Install Rust on Fedora.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Sample output

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'
703.5 KiB / 703.5 KiB (100 %) 404.6 KiB/s in  1s ETA:  0s
info: latest update on 2022-08-11, rust version 1.63.0 (4b91a6ea7 2022-08-08)
info: downloading component 'cargo'
  6.6 MiB /   6.6 MiB (100 %) 586.8 KiB/s in 11s ETA:  0s
info: downloading component 'clippy'
  2.8 MiB /   2.8 MiB (100 %) 605.1 KiB/s in  4s ETA:  0s
info: downloading component 'rust-docs'
 18.3 MiB /  18.3 MiB (100 %) 499.2 KiB/s in 35s ETA:  0s
info: downloading component 'rust-std'
 26.1 MiB /  26.1 MiB (100 %) 400.6 KiB/s in  1m  5s ETA:  0s
info: downloading component 'rustc'
 54.3 MiB /  54.3 MiB (100 %) 643.2 KiB/s in  1m 37s ETA:  0s
info: downloading component 'rustfmt'
  4.1 MiB /   4.1 MiB (100 %) 588.7 KiB/s in  7s ETA:  0s
info: installing component 'cargo'
  6.6 MiB /   6.6 MiB (100 %)   3.5 MiB/s in  1s ETA:  0s
info: installing component 'clippy'
info: installing component 'rust-docs'
 18.3 MiB /  18.3 MiB (100 %)   1.4 MiB/s in 21s ETA:  0s    
info: installing component 'rust-std'
 26.1 MiB /  26.1 MiB (100 %)   5.0 MiB/s in  5s ETA:  0s
info: installing component 'rustc'
 54.3 MiB /  54.3 MiB (100 %)   4.7 MiB/s in 11s 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.63.0 (4b91a6ea7 2022-08-08)


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 ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"
  • After Rust installation, activate its environment using the commands below.
source ~/.profile
source ~/.cargo/env
  • To check the version of Rust version installed on your system run the following command.
rustc -V
  • Next, add the rust compiler to Fedora.
sudo dnf install rustc

Sample Rust Application

  • Run the command below to create a directory for your demo app.
mkdir Sampleproject
  • Go to the directory above.
cd Sampleproject
  • Let’s create the demo app using the following command.
sudo nano helloguys.rs
  • Copy code below then save(ctrl+s) and close(ctrl+x) the file.
fn main() {
    println!("Hello from itnixpro.com!");
}
  • Next, compile the created app using the command below.
rustc helloguys.rs
  • Run the compiled app using the following command.
./helloguys

Update Rust on Fedora 36

  • Update Rust by running the command below.
rustup update

Uninstall Rust on Fedora 36

  • To remove Rust run the command below.
rustup self uninstall
  • That concludes our article, we have gone through how to install Rust on Fedora 36.

Read more about Rust

Other Tutorials

Install Django on Rocky Linux 9

Install PHP 8 on Rocky Linux 9

Install LAMP Stack on Rocky Linux 9

System administrator | Software Developer | DevOps

Leave a Comment