CentOS Stream 8
Sponsored Link

Rust : Install2021/04/12

 
Install Rust Language.
[1] Confirm the current enabled stream of Rust and Install it.
[root@dlp ~]#
dnf module list rust-toolset

CentOS Stream 8 - AppStream
Name                   Stream              Profiles             Summary
rust-toolset           rhel8 [d]           common [d]           Rust

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# install Rust

[root@dlp ~]#
dnf module -y install rust-toolset:rhel8

Dependencies resolved.
================================================================================
 Package           Arch   Version                               Repo       Size
================================================================================
Upgrading:
 glibc             x86_64 2.28-154.el8                          baseos    3.6 M
 glibc-common      x86_64 2.28-154.el8                          baseos    1.3 M
 glibc-langpack-en x86_64 2.28-154.el8                          baseos    827 k
Installing group/module packages:
 rust-toolset      x86_64 1.49.0-1.module_el8.4.0+711+9442cdbb  appstream  12 k
Installing dependencies:
 cargo             x86_64 1.49.0-1.module_el8.4.0+711+9442cdbb  appstream 3.9 M
 cpp               x86_64 8.4.1-1.el8                           appstream  10 M
 gcc               x86_64 8.4.1-1.el8                           appstream  23 M
 glibc-devel       x86_64 2.28-154.el8                          baseos    1.0 M
 glibc-headers     x86_64 2.28-154.el8                          baseos    479 k
 isl               x86_64 0.16.1-6.el8                          appstream 841 k
 kernel-headers    x86_64 4.18.0-294.el8                        baseos    7.1 M
 libmpc            x86_64 1.1.0-9.1.el8                         appstream  61 k
 libxcrypt-devel   x86_64 4.1.1-4.el8                           baseos     25 k
 llvm-libs         x86_64 11.0.0-2.module_el8.4.0+587+5187cac0  appstream  21 M
 rust              x86_64 1.49.0-1.module_el8.4.0+711+9442cdbb  appstream  31 M
 rust-std-static   x86_64 1.49.0-1.module_el8.4.0+711+9442cdbb  appstream  22 M
Installing module profiles:
 rust-toolset/common

Enabling module streams:
 llvm-toolset             rhel8
 rust-toolset             rhel8

Transaction Summary
================================================================================
Install  13 Packages
Upgrade   3 Packages

.....
.....

[root@dlp ~]#
rustc --version

rustc 1.49.0
# verify to create test program

[root@dlp ~]#
mkdir rust-test

[root@dlp ~]#
cd rust-test

[root@dlp rust_test]# cat > hello-rust.rs <<'EOF'
fn main() {
    println!("Hello Rust world !");
}
EOF 

[root@dlp rust_test]#
rustc hello-rust.rs

[root@dlp rust_test]#
./hello-rust

Hello Rust world !
# verify to create Hello World with Cargo

[root@dlp ~]#
cargo --version

cargo 1.49.0
[root@dlp ~]#
cargo new cargo-test --bin

     Created binary (application) `cargo-test` package
[root@dlp ~]#
cd cargo-test

[root@dlp cargo_test]#
cargo build

   Compiling cargo-test v0.1.0 (/root/rust-test/cargo-test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s

[root@dlp cargo_test]#
cargo run

    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/cargo-test`
Hello, world!
Matched Content