Ubuntu 22.10にRust をインストールする

環境
OSのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.10
DISTRIB_CODENAME=kinetic
DISTRIB_DESCRIPTION="Ubuntu 22.10"
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.10 DISTRIB_CODENAME=kinetic DISTRIB_DESCRIPTION="Ubuntu 22.10"
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.10
DISTRIB_CODENAME=kinetic
DISTRIB_DESCRIPTION="Ubuntu 22.10"

操作方法
1.Rustをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt -y install rust-all
# apt -y install rust-all
# apt -y install rust-all

2.Rustのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# rustc --version
rustc 1.61.0
# rustc --version rustc 1.61.0
# rustc --version
rustc 1.61.0

3.テストプログラムを作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mkdir rusttest
# cd rusttest
# nano test.rs
# mkdir rusttest # cd rusttest # nano test.rs
# mkdir rusttest
# cd rusttest
# nano test.rs

以下のコードを記述します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
fn main() {
println!("Hello Rust world from arkgame!");
}
fn main() { println!("Hello Rust world from arkgame!"); }
fn main() {
    println!("Hello Rust world from arkgame!");
}

4.動作確認 ファイルをコンパイルして実行します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# rustc test.rs
# ./test
Hello Rust world from arkgame!
# rustc test.rs # ./test Hello Rust world from arkgame!
# rustc test.rs
# ./test
Hello Rust world from arkgame!

 

Ubuntu 22.10

Posted by arkgame