4.1. Prerequisites for Developing your own Snap

4.1.1. Introduction

In this document, we will setup a development system for building Snaps using Snapcraft.

4.1.2. Operating System

To build snaps, an Ubuntu system with version 16.04 is required.

Note

Ubuntu 16.04 LTS (long term support) is required for building Snaps that will run on the Cascade Edge Gateway

There are a couple of different options for setting up a development environment.

Raspberry Pi

Some applications will require the use of a Raspberry Pi 2 or 3. If your application is written in NodeJS, for instance, it will not be able to compile for an Arm architecture if it’s built on an x86-architecture machine. Follow these two sets of instructions to get started:

  1. Install Ubuntu Core on a Raspberry Pi 2 or 3. We recommend using the stable image, unless you need the Pi to use Wi-Fi.
  2. Ubuntu Core has a guide about how to develop snaps on the same machine that will use them. Complete the section Developing on the target device.

Dedicated Machine

If you have an available desktop or laptop computer, you can install Ubuntu 16.04 LTS directly onto that machine. Follow the directions on Ubuntu’s website to get started.

Virtual Machine

If you already have a machine running Windows, macOS, or even another Linux distribution, a virtual machine is a great option. One no-cost option for a virtual machine is Virtual Box.

To get started with Virtual Box, check out: Installing Ubuntu with Virtual Box

Once Ubuntu is installed and you have logged in, move on to the next section.

4.1.3. Setting up for Snap Development

This section requires using a terminal on the Ubuntu system. To launch the terminal, click Search your computer (the top icon in the Dock on the left side of the desktop). In the window that appears, type terminal and then click on the Terminal icon.

To install Snapcraft, run the following command and then verify it with the version.

Note

Your version may not match. 2.40 is the current version when this document was created.

$ snap install snapcraft --classic

... flurry of output

$ snapcraft version
snapcraft, version 2.42.1

4.1.4. Conclusion

In this document we covered setting up an Ubuntu development system, and installing Snapcraft.