This topic describes how to build the runtime environment on Raspberry Pi for the Standard edition of Link IoT Edge (LE Standard).
Hardware | Operating System (OS) |
---|---|
Raspberry PI 3B | Raspbian |
Link IoT Edge can also run on other Raspberry Pi hardware, such as Raspberry Pi 2B, 3B+, and 4B. However, for optimal stability and security, we recommend that you use the hardware that is listed in the table.
Preparations
Item | Specifications |
---|---|
Raspberry Pi | Raspberry PI 3B |
OS | Raspbian Stretch with desktop |
Kernel | ≥ 4.13 |
Micro SD card | ≥ 8 GB |
Peripherals | An HDMI cable, keyboard, mouse, and MicroUSB cable |
Environment settings
You need to configure the environment required for running Link IoT Edge on your Raspberry Pi device. If you have Raspbian installed on your Raspberry Pi device, you can skip to Step 3.
- Download the Raspbian image and the SD image flashing tool.
- Operating system image: Raspbian Stretch with desktop
- SD card image flashing tool: EtcherNote Download the image flasher that is suitable for your OS.
- Use Etcher to flash the Raspbian image to the SD card.Insert the Micro SD card into a card reader and plug it to your computer. For more information about flashing the Raspbian image to the Micro SD card, visit Installation guide for Raspberry Pi image.
- Start and configure the Raspbian OS.Insert the Micro SD card into your Raspberry Pi device and connect the peripherals, such as the mouse, keyboard, monitor, and the MicroUSB cable. Then, start your Raspberry Pi device.After the SSH service is started, run the
hostname -I
command to obtain the IP address of the Raspberry Pi device and log on to the Raspberry Pi device remotely by using an SSH. - Check the runtime dependencies of Link IoT Edge.
Create an edge instance and a gateway
- Log on to the Link IoT Edge console.
- In the left-side navigation pane, click Edge Instances.
- Create an edge instance.
- After you configure the required parameters, click OK.
Install and launch Link IoT Edge
After you create an edge instance and a gateway, you must install and start Link IoT Edge on the gateway.
- On the Edge Instances page, click Install Software in the Actions column of the required edge instance.
- Specify the parameters for the installation command based on the environment, and click Installation Command.
Table 4. Parameters Parameter Description Edge Gateway CPU Architecture The CPU architecture of your device system. In this example, select ARMv7 VFPv3. Instance Type The Link IoT Edge edition that you specified when you created the edge instance. In this dialog box, you cannot change the Link IoT Edge edition. Edge Version The Link IoT Edge version for installation.
Operating System The operating system of your device. Select Linux. - Copy the installation command for subsequent use.
- Log on to the OS of your Raspberry Pi device.
- Run the command copied in step 3 in any directory.
The command is used to download, configure, and start Link IoT Edge with one click. After the command is executed, the link-iot-edge-standard.sh script is downloaded to the current directory.Note If this is not your first time to install and start Link IoT Edge, you can execute the link-iot-edge-standard.sh script to restart or stop Link IoT Edge, obtain its status, and modify its configuration parameters. The following figure shows the commands in the script.
- Run the following command to check the status of Link IoT Edge.
sudo ./link-iot-edge-standard.sh --status
If the following information is displayed in the command output, Link IoT Edge is started as expected.
You can also check the gateway status by performing the following steps: Log on to the Link IoT Edge console. In the left-side navigation pane, click Edge Instances. On the page that appears, find the edge instance that you created and click View in the Actions column. On the Gateways tab of the Instance Details page, check the gateway status.
You can perform remote gateway management by turning on Remote Access. For more information about the procedure, see Remote service access.
- Optional. On the Instance Details page, check the CPU utilization, memory usage, and storage usage, and authorize instance processes to access CloudMonitor.
- Optional. Authorize other Alibaba Cloud users to perform the required operations on the instance.On the Edge Instances page, click Authorize in the upper-left corner of the page. In the dialog box that appears, click Add Authorization. In the dialog box that appears, set the required parameters as prompted.
Table 5. Parameters Parameter Description Authorized User UID The Alibaba Cloud account ID of the user that you want to authorize. Authorized Instance The edge instance on which you want to authorize the Alibaba Cloud account to perform remote O&M.
Use systemd to manage Link IoT Edge
Use systemd to start or stop Link IoT Edge or view the status of Link IoT Edge.
The systemd service file of Link IoT Edge is as follows:
[Unit]
Description=Link IoT Edge
[Service]
Type=forking
Restart=on-failure
ExecStart=/linkedge/gateway/build/script/iot_gateway_start.sh
ExecReload=/linkedge/gateway/build/script/iot_gateway_start.sh
ExecStop=/linkedge/gateway/build/script/iot_gateway_stop.sh
[Install]
WantedBy=multi-user.target
Run the following commands to download the service file and copy it to the /etc/systemd/system/ directory.
wget http://iotedge-web.oss-cn-shanghai.aliyuncs.com/public/testingTool/LinkIoTEdge.service
sudo cp LinkIoTEdge.service /etc/systemd/system/LinkIoTEdge.service
Run the following commands to start or restart Link IoT Edge:
- Start Link IoT Edge:
sudo systemctl start LinkIoTEdge.service
- Restart Link IoT Edge:
sudo systemctl restart LinkIoTEdge.service
Run the following command to stop Link IoT Edge:
sudo systemctl stop LinkIoTEdge.service
Run the following command to enable service running at startup:
sudo systemctl enable LinkIoTEdge.service
What to do next
After the environment is built, you can connect your devices to Link IoT Edge by referring to Device access. You can also allocate additional resources, such as Function Compute resources and message routers, to edge instances to manage your devices.
After you connect a device to Link IoT Edge or allocate additional resources to an edge instance, you must perform the following steps to deploy the edge instance:
- On the Instance Details page, click Deploy in the upper-right corner. In the message that appears, click OK.
- If the deployment status is Deployed, the instance is deployed. You can click View Logs to view deployment details. You can also click View Deployment Logs in the upper-right corner of the Instance Details page to view the deployment history.