Difference between revisions of "IoTGateway/IoTEdge"

From ESS-WIKI
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
== Moby ==
 
== Moby ==
  
To install Moby-engine for Arm platforms based on the [https://docs.docker.com/engine/install/ubuntu/ Docker document].
+
To install Moby-engine for Arm platforms.
  
$ sudo apt-get update
+
  $ curl [https://packages.microsoft.com/config/ubuntu/18.04/multiarch/prod.list https://packages.microsoft.com/config/ubuntu/18.04/multiarch/prod.list] > ./microsoft-prod.list
$ sudo apt-get install lsb-release curl gpg \
+
  $ sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/
        apt-transport-https \
+
$ curl [https://packages.microsoft.com/keys/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc] | gpg --dearmor > microsoft.gpg
        ca-certificates \
+
$ sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/
        curl \
 
        gnupg-agent \
 
        software-properties-common
 
 
  $ curl -fsSL [https://download.docker.com/linux/ubuntu/gpg https://download.docker.com/linux/ubuntu/gpg] | sudo apt-key add -
 
 
  $ sudo add-apt-repository \
 
        "deb [arch=armhf] [https://download.docker.com/linux/ubuntu https://download.docker.com/linux/ubuntu] \
 
        $(lsb_release -cs) \
 
        stable"
 
 
   
 
   
 
  $ sudo apt-get update
 
  $ sudo apt-get update
  $ sudo apt-get install moby-engine moby-cli
+
  $ sudo apt-get install moby-engine
  
 
== IoT Edge ==
 
== IoT Edge ==
  
Get the latest stable version and install maunally, e.g. we have 1.0.9 currently.
+
Install the latest stable version.
 +
 
 +
$ sudo apt-get install iotedge
 +
 
 +
Or, you can get the specific version and install maunally, e.g. we have 1.0.9 currently.
  
 
  $ wget [https://github.com/Azure/azure-iotedge/releases/download/1.0.9/iotedge_1.0.9-1_ubuntu16.04_armhf.deb https://github.com/Azure/azure-iotedge/releases/download/1.0.9/iotedge_1.0.9-1_ubuntu16.04_armhf.deb]
 
  $ wget [https://github.com/Azure/azure-iotedge/releases/download/1.0.9/iotedge_1.0.9-1_ubuntu16.04_armhf.deb https://github.com/Azure/azure-iotedge/releases/download/1.0.9/iotedge_1.0.9-1_ubuntu16.04_armhf.deb]
Line 43: Line 37:
 
  iotedge 1.0.9
 
  iotedge 1.0.9
  
 +
= Configuration & Deployment =
  
 +
For Azure configurations, please refer to [[#References|[1]]] for details. You can learn how to create a IoT hub and register an IoT Edge device.
  
= Configuration & Deployment =
+
To fix DNS check error, add DNS settings for Docker.
  
For Azure configurations, please refer to [[#References|[1]]] for details. You can learn how to create a IoT hub and register an IoT Edge device.
+
$ vim /etc/docker/daemon.json
 +
{
 +
        "dns": ["8.8.8.8"]
 +
}
 +
$ sudo systemctl restart docker
  
 
== Provisioning ==
 
== Provisioning ==
Line 58: Line 58:
 
  provisioning:
 
  provisioning:
 
   source: "manual"
 
   source: "manual"
   '''device_connection_string''':  "HostName=pnptest.azure-devices.net;DeviceId=DanielTTest;SharedAccessKey=dgls932Y/ej8/quF+b+Kg/Bbd4V+PaQOc54upbO/09c="
+
   '''device_connection_string''':  "HostName=pnptest.azure-devices.net;DeviceId=XXX;SharedAccessKey=dgls932Y/ej8/quF+b+Kg/Bbd4V+PaQOc54upbO/09c="
  
 
Then, run the commands below to make sure iot Edge device is running well.
 
Then, run the commands below to make sure iot Edge device is running well.

Latest revision as of 10:36, 19 May 2020

Installation

We use EPC-R3220 as an example.

  • Version: R3220A1AIM20UIV20003_am335x_2020-04-13
  • OS: Ubuntu 18.04
  • Kernel: 4.14.79

Moby

To install Moby-engine for Arm platforms.

$ curl https://packages.microsoft.com/config/ubuntu/18.04/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/

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

IoT Edge

Install the latest stable version.

$ sudo apt-get install iotedge

Or, you can get the specific version and install maunally, e.g. we have 1.0.9 currently.

$ wget https://github.com/Azure/azure-iotedge/releases/download/1.0.9/iotedge_1.0.9-1_ubuntu16.04_armhf.deb
$ wget https://github.com/Azure/azure-iotedge/releases/download/1.0.9/libiothsm-std_1.0.9-1_ubuntu16.04_armhf.deb

$ sudo dpkg -i *.deb

Once it's done, you can get the iotedge version correctly.

$ iotedge --version
iotedge 1.0.9

Configuration & Deployment

For Azure configurations, please refer to [1] for details. You can learn how to create a IoT hub and register an IoT Edge device.

To fix DNS check error, add DNS settings for Docker.

$ vim /etc/docker/daemon.json
{
        "dns": ["8.8.8.8"]
}
$ sudo systemctl restart docker

Provisioning

To manually provision a device, you need to provide it with a device connection string that you can create by registering a new device in your IoT hub.

$ cd /etc/iotedge
$ sudo chmod 666 config.yaml
$ sudo vim config.yaml
provisioning:
  source: "manual"
  device_connection_string:  "HostName=pnptest.azure-devices.net;DeviceId=XXX;SharedAccessKey=dgls932Y/ej8/quF+b+Kg/Bbd4V+PaQOc54upbO/09c="

Then, run the commands below to make sure iot Edge device is running well.

$ sudo systemctl restart iotedge
$ systemctl status iotedge
· iotedge.service - Azure IoT Edge daemon  
  Loaded: loaded (/lib/systemd/system/iotedge.service; enabled; vendor  preset:  
  Active: active (running)

$ sudo iotedge list
NAME             STATUS           DESCRIPTION      CONFIG
edgeAgent        running          Up 30 seconds     mcr.microsoft.com/azureiotedge-agent:1.0

You are able to see the device is connected on Azure as well.

Deploy

To deploy a module into IoT Edge device, please refer to [3] for details.


References