プログラミング

Ubuntu24.04系にRustをインストール

UbuntuにRustをインストールするまでをメモ。

手順

Curlのインストール(インストールされてない場合)

以下のコマンを実行。

curl -I http://www.google.com

エラーの場合、事前にインストールする。

sudo apt list curl

Rustのインストール

Rustupのコマンドでインストール

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

インストール中に以下が表示されたら「1」を選択。

1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation

最後に再読み込み

. "$HOME/.cargo/env"  

動作確認

任意のディレクトリで

cargo new hello

Helloディレクトリに移動して実行。

cd hello
cargo run
cd hello
cargo run

「Hello, world!」と表示されればOK。

cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/hello`
Hello, world!

-プログラミング