Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Guide to Ubuntu Core and Snaps

DZone's Guide to

A Guide to Ubuntu Core and Snaps

Learn about Ubuntu Core's role in IoT development and how Snaps, as a packaging system, augment Linux, containers, and IoT.

· IoT Zone
Free Resource

Learn how Bluetooth mesh helps you create industrial-grade networks. Download the mesh overview.

Despite being a Mac user for nearly 20 years, I have always had a soft spot for Ubuntu. Whilst they have not always been successful, I have respected their attempts to pull Linux into the mainstream and try new ideas and paradigms with it. They have weathered the storm of Ubuntu phone and Unity and are meeting success with two newer projects, The lean Ubuntu Core, and their universal Linux packaging format, snaps.

I spoke with Dustin Kirkland, VP of product development and Jamie Bennett, VP of Devices and IoT Engineering at Canonical to understand more the strategy behind the projects. Listen to the interview, and when you’re finished return here for a brief introduction.

Ubuntu Core

Ubuntu Core is a tiny, transactional version of Ubuntu designed for IoT devices and large container deployments. I’ve met Canonical staff at a variety of conferences and seen Core running on robots, signage, and IoT devices. With a total base size of less than 350Mb, Core is somewhere in the middle of container OS sizes, with CentOS Atomic over 700Mb, and Alpine under 150Mb.

Everything is Ubuntu Core is a ‘snap’, including the Linux Kernel and the minimal OS, meaning you can customize your installation to what you need. What is a snap? I’m glad you asked.

Snaps, the Universal Linux Packaging System

As a casual Linux user, I have always wondered if the different packaging formats are harmful to user experience. As the core of each distribution overlaps, and there are common development frameworks, doesn’t the need to support more than one distribution restrict a potential audience? Whilst creating packages for multiple distributions isn’t too complex, desktop Linux usage is already a small percentage, with poor support from a lot of large application vendors. Linux is a tinkerer's OS, and a lot of users are comfortable building from source, but still, new users unable to find an application package for their distribution is a detraction.

Snaps aims to solve this issue, but also, packaging applications for Linux running on IoT devices, containers, and other slim, non-desktop installations.

Create Your Own

The Ubuntu website has a comprehensive getting started tutorial, and I won’t repeat that here, but point out useful points that explain the overarching concepts of Snaps.

As is common with packaging formats, the magic that ties a snap together is a snapcraft.yaml file that details the build steps and metadata.

name: Dzone
version:'1.0'
# A string, so can be a number or text
summary: The Dzone Snap
description: The latest articles from Dzone
grade: devel
# stable or devel, which keeps snap out of distribution channels
confinement: devmode
# devmode during development and strict when you are ready to release


Snaps consist of ‘parts’, which you can think of as logical areas of your application, in each part you describe where the code comes from, how to build it, and the commands associated with them. You can pull code from Git, Bazaar, Mercurial and SVN, or Tar and Zip files over FTP. Snaps support applications written in Java, Python, Node, Go and Rust, and supports building with Kbuild, make, qmake, autotools, cmake, scons, meson, and waf. When you build the snap or a user installs it, snapcraft (the full product name) will handle dependencies.

If you’re looking for a more seamless process that fits a development workflow, then the Snapcraft build service might be what you’re looking for. It watches for changes in GitHub (hopefully other version control systems later), tests, builds and releases your snaps based on those changes.

Image from here.

For a deeper look into Bluetooth mesh, check out this technical insight for developers.

Topics:
ubuntu ,linux ,iot ,cloud containers ,snap ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}