CentOS Stream 10
Sponsored Link

Rust : Install2025/02/12

 

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:
 cargo                             x86_64                   1.84.1-1.el10                     appstream                   7.1 M
 rust                              x86_64                   1.84.1-1.el10                     appstream                    27 M
Installing dependencies:
 cpp                               x86_64                   14.2.1-6.el10                     appstream                    13 M
 gcc                               x86_64                   14.2.1-6.el10                     appstream                    38 M
 glibc-devel                       x86_64                   2.39-32.el10                      appstream                   639 k
 kernel-headers                    x86_64                   6.12.0-51.el10                    appstream                   2.1 M
 libmpc                            x86_64                   1.3.1-7.el10                      appstream                    71 k
 libxcrypt-devel                   x86_64                   4.4.36-10.el10                    appstream                    30 k
 make                              x86_64                   1:4.4.1-9.el10                    baseos                      587 k
 rust-std-static                   x86_64                   1.84.1-1.el10                     appstream                    39 M

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

[root@dlp ~]#
rustc --version

rustc 1.84.1 (e71f9a9a9 2025-01-27) (Red Hat 1.84.1-1.el10)
# 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.84.1 (66221abde 2024-11-19)
[root@dlp ~]#
cargo new cargo-test --bin

    Creating binary (application) `cargo-test` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[root@dlp ~]#
cd cargo-test

[root@dlp cargo_test]#
cargo build

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

[root@dlp cargo_test]#
cargo run

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