3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry PiでAzure IoT Edge v1.2ランタイムインストール - Ubuntu Server 20.04 64bit編

Last updated at Posted at 2021-06-02

Azure IoT Edge v1.2 ランタイムからは既存インストール手順と異なるため、新たに整理します。
v1.1以下のランタイムインストールについては下記の手順をご参照ください。

そして、v1.1からv1.2へアップデートについては下記の手順をご参照ください。

Ubuntu 20.04 Server 64bitのRaspberry Piにインストールする手順についてなるべく簡単にまとめます。
公式ドキュメントではUbuntu 18.04 AMD64をTier 1としてサポートしていますが、最新のUbuntu 20.04 ARM64はTier 2としてサポートしてます。

Tier 1 : Microsoft社が確認とインストールパッケージを提供
Tier 2 : Microsoft社は非公式サポート、Azure IoT Edgeと互換性あるので使用可能

image.png

不要な内容とゴミが残らないような手順で整理しておきます。
基本、Ubuntu 18.04手順をUbuntu 20.04でもそのまま使えます。
(去年までは追加手順が必要でしたが、現在は不要です)

バージョン確認

最新のUbuntu Server 20.04.X 64bitをインストールしてください。
https://ubuntu.com/download/raspberry-pi

image.png

$ uname -a
Linux ubuntu 5.4.0-1035-raspi #38-Ubuntu SMP PREEMPT Tue Apr 20 21:37:03 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

インストールパッケージのリポジトリ設定

$ curl https://packages.microsoft.com/config/ubuntu/18.04/multiarch/prod.list > ./microsoft-prod.list
$ sudo mv ./microsoft-prod.list /etc/apt/sources.list.d/
$ curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
$ sudo mv ./microsoft.gpg /etc/apt/trusted.gpg.d/

コンテナーエンジンのインストール

$ sudo apt update
$ apt list -a moby-engine
...
moby-engine/bionic 20.10.6+azure-1 amd64
moby-engine/bionic 20.10.5+azure-1 amd64
moby-engine/bionic 20.10.3+azure-1 amd64
moby-engine/bionic 20.10.2+azure-1 amd64
moby-engine/bionic 19.03.15+azure-1 amd64
moby-engine/bionic 19.03.14+azure-1 amd64
...
$ sudo apt install -y moby-engine
$ sudo usermod -aG docker ${USER}

IoT Edgeセキュリティデーモンのインストール

$ apt list -a aziot-edge
Listing... Done
...
aziot-edge/bionic 1.2.0-1 amd64
aziot-edge/bionic 1.2.0~rc4-1 amd64
aziot-edge/bionic 1.2.0~rc4~device-update-tutorial-1 amd64
...
$ sudo apt install -y aziot-edge
$ sudo reboot now

デバイスのプロビジョニング

v1.2からは二つ方式について設定可能です。
こちらはテンプレートファイルから設定ファイルを作成する方式で説明します。

$ sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml
$ sudo vi /etc/aziot/config.toml
...
# Manual provisioning with connection string
[provisioning]
source = "manual"
connection_string = "<ADD DEVICE CONNECTION STRING HERE>"
...
$ sudo iotedge config apply
Note: Symmetric key will be written to /var/secrets/aziot/keyd/device-id
Azure IoT Edge has been configured successfully!

Restarting service for configuration to take effect...
Stopping aziot-edged.service...Stopped!
Stopping aziot-identityd.service...Stopped!
Stopping aziot-keyd.service...Stopped!
Stopping aziot-certd.service...Stopped!
Stopping aziot-tpmd.service...Stopped!
Starting aziot-edged.mgmt.socket...Started!
Starting aziot-edged.workload.socket...Started!
Starting aziot-identityd.socket...Started!
Starting aziot-keyd.socket...Started!
Starting aziot-certd.socket...Started!
Starting aziot-tpmd.socket...Started!
Starting aziot-edged.service...Started!
Done.
$ sudo iotedge system status
System services:
    aziot-edged             Running
    aziot-identityd         Running
    aziot-keyd              Running
    aziot-certd             Running
    aziot-tpmd              Ready

Use 'iotedge system logs' to check for non-fatal errors.
Use 'iotedge check' to diagnose connectivity and configuration issues.
$ iotedge list
NAME             STATUS           DESCRIPTION      CONFIG
edgeAgent        running          Up a minute      mcr.microsoft.com/azureiotedge-agent:1.2
$ docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED              STATUS              PORTS     NAMES
5eb7fc0czb8a   mcr.microsoft.com/azureiotedge-agent:1.2   "/bin/sh -c 'exec /a…"   About a minute ago   Up About a minute             edgeAgent

注意点

ありません。わずか数分でインストールできます。
最新のRaspberry PiのUbuntu Server 20.04.X 64bit OSがインストールしてある状態なら、問題なくAzure IoT Edgeランタイムをインストールできます。

One more thing

IoT EdgeデバイスにDeployment Manifestを作成するには下記のウェブサイトで作成することをお勧めします。
フローダイアグラムでIoT Edgeモジュールを配置してDeployment Manifestをダウンロードできます。

image.png

3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?