CentOS Stream 9
Sponsored Link

Rust : Install2022/06/17

 
Install Rust Language.
[1] Install Rust Language and try to run test app.
[root@dlp ~]#
dnf -y install rust cargo

Dependencies resolved.
================================================================================
 Package               Architecture Version               Repository       Size
================================================================================
Installing:
 rust                  x86_64       1.61.0-1.el9          appstream        26 M
Installing dependencies:
 cpp                   x86_64       11.3.1-2.el9          appstream        11 M
 gcc                   x86_64       11.3.1-2.el9          appstream        32 M
 glibc-devel           x86_64       2.34-32.el9           appstream        37 k
 glibc-headers         x86_64       2.34-32.el9           appstream       534 k
 kernel-headers        x86_64       5.14.0-109.el9        appstream       2.6 M
 libmpc                x86_64       1.2.1-4.el9           appstream        62 k
 libxcrypt-devel       x86_64       4.4.18-3.el9          appstream        29 k
 make                  x86_64       1:4.3-7.el9           baseos          538 k
 rust-std-static       x86_64       1.61.0-1.el9          appstream        27 M

Transaction Summary
================================================================================
Install  10 Packages
.....
.....

[root@dlp ~]#
rustc --version

rustc 1.61.0 (Red Hat 1.61.0-1.el9)
# 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.61.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/cargo-test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s

[root@dlp cargo_test]#
cargo run

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