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.
|Raspberry Pi||Raspberry PI 3B|
|OS||Raspbian Stretch with desktop|
|Micro SD card||≥ 8 GB|
|Peripherals||An HDMI cable, keyboard, mouse, and MicroUSB cable|
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.
- 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
- Connect the Raspberry Pi device to the Internet through Wi-Fi or Ethernet. For more information, see Configure Wi-Fi for Raspberry Pi.
- Configure the SSH service.
- Run the
sudo systemctl start sshcommand to enable the SSH service.
- Run the
sudo systemctl status sshcommand to view the SSH service.
- Run the
sudo systemctl enable sshcommand to enable the SSH service at startup.
- Run the
hostname -Icommand 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.
- Run the following command in the local terminal window or SSH terminal window of your
Raspberry Pi device to download and run the tool for checking the runtime environment.
wget http://iotedge-web.oss-cn-shanghai.aliyuncs.com/public/testingTool/link-iot-edge_env-check.sh sudo chmod +x ./link-iot-edge_env-check.sh sudo ./link-iot-edge_env-check.shNote You must run the link-iot-edge_env-check.sh script as a root user on the platforms that are supported by LE Standard. The platform must also support the following Linux commands: printf, echo, cat, ls, expr, grep, test, uname, set, head, sort, cut, uniq, xargs, and ifconfig.
- Install the required dependencies on your device as prompted by the checking tool.
If the following information is displayed after the checking is completed, Link IoT
Edge can run on your machine.
- Run the following command in the local terminal window or SSH terminal window of your Raspberry Pi device to download and run the tool for checking the runtime environment.
Create an edge instance and a gateway
- In the left-side navigation pane of the IoT Platform console, choose .
- Create an edge instance.
- Click Create Instance. In the dialog box that appears, set Instance Name.
Note Instance Name cannot exceed 20 characters in length and can contain letters, digits, underscores (_), and hyphens (-).
- On the Gateway Products page, click Create Gateway Product to create a gateway for the instance.
Gateways in Link IoT Edge provide edge computing capabilities. Each instance must be associated with a gateway device. A gateway device can be associated with only one edge instance at a time.
- In the Create Product dialog box that appears, set the parameters and click OK.
Create Gateway Product in Link IoT Edge inherits the features of in the IoT Platform console. The product creation procedure is simplified, which allows you to quickly create gateway products that are suitable for Link IoT Edge.
Table 1. Parameters for creating a gateway product Parameter Description Product Name The name of the gateway product, which is used to query and identify a gateway product. The name must be 4 to 30 characters in length and can contain letters, digits, and underscores (_). Product Description The description of the product. You can enter a maximum of 100 characters. It can be left blank.
After the product is created, the Create Instance dialog box appears and the created gateway product is automatically displayed under Gateway Products.
- In the Create Instance dialog box, click Create Gateway Device under Gateway Devices.
Create Gateway Device in Link IoT Edge inherits the features ofin the IoT Platform console.
- Set the parameters as prompted and click OK.
Table 2. Parameters for creating a gateway device Parameter Description Product The gateway product to which the device that you want to create belongs. The system automatically associates with the newly created gateway product. Device Name The name of the gateway device. The device name must be unique. If you do not specify this parameter, the system automatically generates a device name.Note The device name must be 4 to 32 characters in length and can contain letters, digits, and the following special characters: hyphens (-), underscores (_), at signs (@), periods (.), and colons (:).
- Set Instance Type of Link IoT Edge based on the environment that you built. For more information, see Specifications.
- Optional. In the Create Instance dialog box, click Add Tag and set instance tags. With tags, you can more effectively classify and identify
instances. You can also choose not to set tags.
To set an instance tag, you must specify Tag Key and Tag Value.
Table 3. Parameters for adding a tag Parameter Description Tag Key The tag key cannot exceed 20 characters in length and can only contain letters. The parameter cannot be left blank and must be unique in an instance. Tag Value The tag value cannot exceed 20 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The parameter cannot be left blank.
- Click Create Instance. In the dialog box that appears, set Instance Name.
- After the parameters of an instance are set, 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.
- In the left-side navigation pane of the IoT Platform console, choose Install Software in the Actions column.
, find the created instance, and click
- 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 running status of the Link IoT Edge service.
sudo ./link-iot-edge-standard.sh --status
If the following information is displayed in the command output, the Link IoT Edge service is launched as expected.
You can also log on to the IoT Platform console. In the left-side navigation pane, choose . On the page that appears, find the target edge instance, 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 enabling the Remote Access feature. 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.
- Add a role or attach an existing role to a user and assign CloudMonitor management permissions to the role by referring to Access resources of other Alibaba Cloud services.
- Click the Monitoring tab and turn on CloudMonitor Status, as shown in the following figure.
After CloudMonitor Status is turned on, you can view monitoring information of the gateway on the Monitoring page.
- Optional. Authorize other Alibaba Cloud users to perform operations, administration,
and management (OAM) on the instance.
On the Edge Instances page, click Authorize in the upper-left corner. In the dialog box that appears, click Add Authorization. In the dialog box that appears, set parameters as prompted.
Table 5. Parameters for user authorization 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 OAM.
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.