Споделяне чрез


Quickstart: Install the Azure Sphere SDK for Linux

You can install the Azure Sphere SDK on a computer running the Linux operating system to develop, deploy, and debug Azure Sphere applications.

Prerequisites

The Azure Sphere SDK installation requires the following prerequisites:

  • An Azure Sphere development kit.
  • A computer with an x86-64-based processor running 64-bit Ubuntu 24.04 LTS, Ubuntu 22.04 LTS, or Ubuntu 20.04 LTS. Only Intel-compatible x86-64 processors are supported; other architectures such as ARM (including the Raspberry Pi), Itanium, or SPARC are not supported. The x86-64 architecture is also known as x64, x86_64, AMD64, and Intel 64.
  • Linux sudo permission.
  • An internet connection or a way to transfer files from a computer that has an internet connection to your computer. For more information, see Install the SDK without an internet connection.

Add required Linux packages

Before you run the SDK installation script, you need to add required Linux packages to your computer if they are not already installed. Enter the following lines in a Linux terminal. You may omit packages that are already installed.

sudo apt-get update
sudo apt-get install -y net-tools curl

Install the Azure Sphere SDK

Follow these steps:

  1. Download the install script.

  2. Navigate to the folder into which you downloaded the compressed file.

  3. Extract the contents of the compressed file. For example, tar xvfz install_azure_sphere_sdk_<version>.tar.gz. The .tar.gz file contains the install_azure_sphere_sdk.sh file.

  4. Run the install script using sudo as follows:

    sudo ./install_azure_sphere_sdk.sh
    

    If you see the error command not found when running the script, enable execution of the install script with this command:

    chmod +x install_azure_sphere_sdk.sh
    
  5. During installation, the script displays confirmation messages. Confirmation messages can be skipped by invoking the script with the -y flag:

    sudo ./install_azure_sphere_sdk.sh -y
    

    Without the -y flag, the script will expect responses to the following prompts:

    The SDK tarball signature is valid. The fingerprint of the key used is:
    
    Primary key fingerprint: <hexadecimal>
    
    Please check that this fingerprint matches the Microsoft GPG public key fingerprint shown on https://aka.ms/AzureSphereSDKVerification/Linux before proceeding. Do not proceed if these values do not match.
    Proceed with installation? (Y/N)
    

    Select Y to start the installation.

    Navigate to Microsoft's public-key fingerprint site and verify that the hexadecimal fingerprint value displayed during installation matches matches the Microsoft Public Key Fingerprint that is shown on the page. Do not proceed if the two fingerprints don't match.

    By proceeding with this installation you agree to the license terms available at https://aka.ms/AzureSphereSDKLicense/Linux and which will be installed to /opt/azurespheresdk. Proceed? (Y/N) y
    Uninstalling previous instance.
    Installing SDK files.
    Installing toolchain version 'xx'.
    Installing toolchain version 'xx'.
    Installing toolchain version 'xx'.
    Installing toolchain version 'xx+Betaxxxx'.
    Installing CLI.
    SDK installed to '/opt/azurespheresdk'.
    Installing Device Communication service.
    Some device operations require root permissions, or permissions granted by a udev rule. 
    Set up the default udev rule and group (azsphere), and add the current user (xxx) to it? (Y/N) y
    Add the Azure Sphere CLI to the PATH for all users (this will add a file to /etc/profile.d/)? (Y/N) y
    Azure Sphere CLI added to PATH for all users. You will need to restart your user session for this change to take effect.
    Azure Sphere SDK installation complete. Visit https://aka.ms/AzureSphereSDK for documentation and samples.
    

    Tip

    Select Y to set up the azsphere group and create the udev rule.

  6. When the installation completes, you must log in again to your desktop application or login shell to initialize the Azure Sphere (Legacy) CLI.

After installation, the azsphere command is on the PATH and the new udev rules for your device are at /etc/udev/rules.d/.

The script installs the SDK to /opt/azurespheresdk and the toolchains to /opt/azurespheresdk/Sysroots/sysroot-version/tools, where sysroot-version identifies a sysroot against which the SDK supports app development.

The installer installs the Azure Sphere (Legacy) CLI. You don't need to uninstall the current version because the installation will update any existing version.

Azure Sphere (Legacy) CLI is installed in /opt/azurespheresdk/Tools_v2.

Udev rules

The Azure Sphere SDK specifies udev rules for your computer's device information. The SDK creates a new group called azsphere and adds the currently logged-in user to the group. The udev rule grants ownership of USB devices matching the Azure Sphere device description. After you install the SDK and reboot your computer, you will not need to use sudo for device recovery or ARM Cortex-M4 debugging.

The azsphere group is added in order to grant permissions using the udev rule. Do not modify the group manually.

Install the SDK without an internet connection

If you don't have an internet connection on the computer on which you're installing the SDK, you need to download the files to a computer that is connected to the internet and transfer them to the installation computer.

  1. Download these files and transfer them to the installation computer:

  2. On the installation computer, navigate to the folder into which you transferred the files.

  3. Extract the contents of the compressed install script file. For example, tar xvfz install_azure_sphere_sdk_<version>.tar.gz. The .tar.gz file contains the install_azure_sphere_sdk.sh file. Leave the Azure Sphere SDK Bundle as a compressed tar file (tar.gz file).

  4. Run the install script using sudo. Include the -i parameter to specify the path to the SDK bundle and the -k parameter to specify the path to the key. Your command should be similar to this:

    sudo ./install_azure_sphere_sdk.sh -i [pathtopackage]/[sdkbundle] -k [pathtokey]/microsoft.asc

    If you see the error command not found when running the script, enable execution of the install script with this command:

    chmod +x install_azure_sphere_sdk.sh
    

Proceed with the installation as described in Install the Azure Sphere SDK.

Install the Azure Sphere extension for Azure CLI

The command-line tool for managing Azure Sphere attached devices and cloud deployments is distributed as an Azure CLI extension. Take the following steps to add or update the extension:

  1. Install the Azure CLI if you have not yet done so.
  • To add the Azure Sphere extension, run the following command:

    az extension add --name azure-sphere
    
  • To update the Azure Sphere extension, run the following command:

    az extension update --name azure-sphere
    

You must Sign in with Azure CLI to log into the Azure subscription you wish to use to manage Azure Sphere devices.

For more information, see Download and run the Azure Sphere extension.

Set up your development environment

You can develop Azure Sphere apps on Linux using either Visual Studio Code or the command-line interface (CLI). No matter which you use, you'll need to install CMake and Ninja on your development machine, if you don't already have them. Refer to instructions for adding the Kitware APT Repository to your installation.

Install CMake and Ninja

To install CMake and Ninja, first refer to instructions for adding the Kitware APT Repository to your installation then use the following command:

sudo apt-get install cmake ninja-build

Note

Do not install cmake or ninja using snap.

Install the Azure Sphere extension for Visual Studio Code

If you want to use Visual Studio Code as your development environment, you need to install it and the Azure Sphere Extension.

  1. Use the links in Download Visual Studio Code to install Visual Studio Code, if you haven't already done so.

  2. To install the Azure Sphere extension, search for "Azure Sphere" in the Extension Marketplace from a browser or within Visual Studio Code. You should see two results, Azure Sphere and Azure Sphere UI. Select Install for either one; the other should be installed automatically.

  3. After installation, you should see Azure Sphere, C/C++, and CMake Tools extensions in the ENABLED Extensions pane in the Visual Studio Code IDE.

When installation is complete, the Readme page for the extension will open. The Readme page provides useful information about Visual Studio Code configuration and requirements, and is updated along with the extension. You can view the Readme page at any time by opening the Extensions pane and selecting Azure Sphere.

Next steps

Note

Do not install cmake or ninja using snap.