やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Rustの環境構築

 所要時間5分くらい。

情報源

インストール

curl https://sh.rustup.rs -sSf | sh

ログ

$ curl https://sh.rustup.rs -sSf | sh

info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin 
directory, located at:

  /home/pi/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile file located at:

  /home/pi/.profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: armv7-unknown-linux-gnueabihf
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
info: syncing channel updates for 'stable-armv7-unknown-linux-gnueabihf'
info: latest update on 2019-05-14, rust version 1.34.2 (6c2484dc3 2019-05-13)
info: downloading component 'rustc'
 69.2 MiB /  69.2 MiB (100 %)   1.2 MiB/s ETA:   0 s       
info: downloading component 'rust-std'
 52.3 MiB /  52.3 MiB (100 %) 395.4 KiB/s ETA:   0 s
info: downloading component 'cargo'
  3.8 MiB /   3.8 MiB (100 %) 562.0 KiB/s ETA:   0 s
info: installing component 'rustc'
 69.2 MiB /  69.2 MiB (100 %)   3.6 MiB/s ETA:   0 s
info: installing component 'rust-std'
 52.3 MiB /  52.3 MiB (100 %)   5.2 MiB/s ETA:   0 s
info: installing component 'cargo'
  3.8 MiB /   3.8 MiB (100 %)   3.6 MiB/s ETA:   0 s
info: default toolchain set to 'stable'

  stable installed - rustc 1.34.2 (6c2484dc3 2019-05-13)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH 
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env
意味 内容
インストールされたもの cargo, rustc, rustup, other commands /home/pi/.cargo/bin
バージョン rustc 1.34.2 (6c2484dc3 2019-05-13)

環境変数PATHに通す

 ~/.bashrcファイルの末尾に以下を追記する。

export PATH=$PATH:$HOME/.cargo/env

対象環境

$ uname -a
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux