LoginSignup
2
3

More than 1 year has passed since last update.

Ubuntu22.04.1にRustインストールしてみた

Posted at

Ubuntuのバージョン

PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
...

Rustインストール

まずはubuntuをアップデートする※すでにしてればスキップ

sudo apt update && sudo apt upgrade -y

念の為、必要なパッケージもインストール

sudo apt install curl build-essential gcc make -y

Rustをインストールする

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

パスの更新

source ~/.profile

インストール完了後にバージョンの確認 

// コンパイラ本体 Rust が正しくインストールされているかどうかを確認
rustc -V
//コンパイラ等をインストールするためのツール
rustup -V

Hello World出してみる

//プロジェクト用のディレクトリを作成していく
$ mkdir workspace
$ cd workspace/

//プロジェクト作成
$ cargo new rust-work
     Created binary (application) `rust-work` package
$ cd rust-work/
$ ls
Cargo.toml  src

//Hello World出力
$ cargo run
   Compiling rust-work v0.1.0 (...)
    Finished dev [unoptimized + debuginfo] target(s) in 0.45s
     Running `target/debug/rust-work`
Hello, world!

おまけ ubuntuにてVisual Studio Codeのインストール方法

下記のサイトでダウンロードする

コマンドでダウンロードしたファイルを展開

$ sudo dpkg -i code_1.70.2-1660629410_amd64.deb 
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3