Debian 11.2にRust言語をインストールする
環境情報
# cat /etc/debian_version
11.2
Rustのインストールの方法
1.Rust をインストールます
# apt -y install rustc
2.Rustバージョンを確認します
# rustc --version rustc 1.48.0
3.テストプログラムを作成します
# nano test.rs
下記の内容を追記します
fn main() {
println!("study Rust become smart");
}
4.rustcでファイルを実行します
ファイルをコンパイルします # rustc test.rs コンパイルしたファイルを実行します # ./test study Rust become smart
5.cargoでファイルを実行します
cargoバージョンを確認します
# cargo --version
cargo 1.46.0
# cargo new sample --bin
Created binary (application) `sample` package
# cd sample
# cargo build
Compiling sample v0.1.0 (/root/sample)
Finished dev [unoptimized + debuginfo] target(s) in 0.37s
# cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/sample`
Hello, world!