Raspberry Pi 4にAzure IoT Edgeをインストールする

Azure IoT Edge、しばらく追っていなかったので久しぶりにインストールしてみることに。

OS

Raspberry Pi Imagerを使って、マイクロSDにOSを書き込みます。
OSは最新のRaspberry Pi OS Lite (32-bit)、2021-05-07版を選びました。

f:id:matsujirushix:20210911112922p:plain

パッケージ管理の設定

Azure IoT Edgeはapt(Advanced Package Tool)でインストールできますが、Raspberry Pi OS標準ではAzure IoT Edgeが置いてあるリポジトリを参照していないので、設定します。

curl https://packages.microsoft.com/config/debian/stretch/multiarch/prod.list > ./microsoft-prod.list
sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/

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

Azure IoT Edge推奨のコンテナエンジンMobyをインストールします。

sudo apt-get update
sudo apt-get install moby-engine

Azure IoT Edgeをインストール

Azure IoT Edgeをインストールします。
実際は、IoT Edgeサービス(aziot-edge)をインストールすると、依存関係にあるIoT IDサービス(aziot-identity-service)も一緒にインストールされます。

sudo apt-get update
sudo apt-get install aziot-edge

サービス稼働を確認

次のコマンドで、サービスが正常にインストールできたか確認できます。

sudo iotedge system status

f:id:matsujirushix:20210911114530p:plain

インストールが完了した時点で、/dev/rootのディスク使用量は約1.6GBでした。
f:id:matsujirushix:20210911114728p:plain