Install the Azure Sphere SDK on Linux

You can install the Azure Sphere SDK on a computer running the Linux operating system to develop, deploy, and debug Azure Sphere applications. This section also describes how to uninstall the SDK, if that becomes necessary in the future.

Prerequisites

The Azure Sphere SDK installation requires the following prerequisites:

  • A computer running Ubuntu 18.04 LTS Edition. Only this edition is supported in the current release.
  • 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. Enable execution of the install script with this command:

    chmod +x install_azure_sphere_sdk.sh

  3. Run the install script. It asks questions and then installs the SDK.

  4. During installation, the script displays a message similar to this:

    The SDK tarball signature is valid. The fingerprint of the key used is:

    Primary key fingerprint: <hex>

Before you continue, check that this fingerprint matches the Microsoft GPG public key fingerprint shown on Microsoft's public-key fingerprint. Do not proceed if the two fingerprints don't match.

When the SDK is completely installed, reboot the computer. 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. Current values are 4 and 4+Beta2001.

Set up a device connection

The Azure Sphere SDK for Linux sets up the required networking settings to allow communication with the attached device. Run the following script as sudo:

sudo /opt/azurespheresdk/Tools/azsphere_connect.sh

You must supply the full path to the script because sudo replaces the PATH variable before a call. You can also supply the following PATH alternative:

sudo $(which azsphere_connect.sh).

If you haven't run azsphere_connect.sh and attempt to run an azsphere command that communicates with a local device, you will be prompted to run the script.

Important

You must run this script whenever you reboot the machine or detach and reattach the device.

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 three files to a computer that is connected to the internet and transfer them to the installation computer.

Download these three files:

On the installation computer, enable execution of the install script with this command:

chmod +x install_azure_sphere_sdk.sh

Run the install script using sudo. Include the -i parameter to specify the path to the SDK 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

To uninstall the Azure Sphere SDK for Linux

When you're finished working with Azure Sphere, here's how to uninstall the current SDK:

  • Delete the /opt/azurespheresdk/ directory and its contents.
  • Delete the /var/opt/azurespheresdk/ directory and its contents.
  • Delete the /etc/profile.d/azure-sphere-sdk.sh script.
  • Delete the /etc/udev/rules.d/75-mt3620.rules file.
  • Run the groupdel command sudo groupdel azsphere to remove the configured group and any users in that group.

Next steps