CentOS 8
Sponsored Link

Rust : インストール2019/12/12

 
Rust をインストールします。
[1] 現在、有効になっている Rust のストリームを確認してインストールします。
[root@dlp ~]#
dnf module list rust-toolset

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

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

# Rust インストール

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

Dependencies resolved.
================================================================================
 Package         Arch   Version                                 Repository
                                                                           Size
================================================================================
Installing group/module packages:
 rust-toolset    x86_64 1.35.0-1.module_el8.0.0+177+7ed049b5    AppStream  10 k
Installing dependencies:
 cargo           x86_64 1.35.0-2.module_el8.0.0+177+7ed049b5    AppStream 3.3 M
 cpp             x86_64 8.2.1-3.5.el8                           AppStream  10 M
 gcc             x86_64 8.2.1-3.5.el8                           AppStream  23 M
 isl             x86_64 0.16.1-6.el8                            AppStream 841 k
 libmpc          x86_64 1.0.2-9.el8                             AppStream  59 k
 llvm-libs       x86_64 7.0.1-3.module_el8.0.0+176+9dc62ab1     AppStream  17 M
 rust            x86_64 1.35.0-2.module_el8.0.0+177+7ed049b5    AppStream  41 M
 rust-std-static x86_64 1.35.0-2.module_el8.0.0+177+7ed049b5    AppStream  34 M
 binutils        x86_64 2.30-49.el8                             BaseOS    5.7 M
 glibc-devel     x86_64 2.28-42.el8.1                           BaseOS    1.0 M
 glibc-headers   x86_64 2.28-42.el8.1                           BaseOS    465 k
 kernel-headers  x86_64 4.18.0-80.11.2.el8_0                    BaseOS    1.6 M
 libxcrypt-devel x86_64 4.1.1-4.el8                             BaseOS     25 k
Installing module profiles:
 rust-toolset/common

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

Transaction Summary
================================================================================
Install  14 Packages
.....
.....

[root@dlp ~]#
rustc --version

rustc 1.35.0
# テストプログラムを作成して動作確認

[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 !
# Cargo で Hello World 動作確認

[root@dlp ~]#
cargo --version

cargo 1.35.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.34s

[root@dlp cargo_test]#
cargo run

    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/cargo_test`
Hello, world!
関連コンテンツ