A ‘snap’ is a universal Linux package

Snaps work on any distribution or device. Snaps are faster to install, easier to create, safer to run, and they update automatically and transactionally so your app is always fresh and never broken.

The public collection of snaps includes the latest and best apps from GitHub and beyond, so you have the whole world of Linux apps at your fingertips. Take the tour below to experience ‘hello world’ as a snap, or jump to the developer guide to create your own snaps.

  • Intel logo
  • POWER logo
  • ARM logo

The ‘hello’ world tour

This tutorial assumes you have Ubuntu 16.04 LTS installed on your desktop, cloud, VM or server. You may need to sudo apt install snapd before continuing.

Log in to the global snap store

The snap store holds a public collection of snaps, and delivers them to clouds, devices and private infrastructure. Sign in and then you will be able to fetch snaps on demand:

$ snap login me@myself.com
Password: *********
2-factor: ******
Welcome!

Snaps don’t intrinsically depend on the Ubuntu store, that’s just what snapd does today, and we expect people will have different stores for their snaps in future.

The store contains both public and private snaps.

Anybody can publish a snap, but if you search the store you will only see snaps that have been reviewed and judged to be of good quality, and which can be installed securely. We call these the ‘promoted’ snaps, and you can search them for a matching name or description:

$ snap find hello
Name           Version  Developer  Notes  Summary
hello          2.10     canonical  -      GNU Hello, the "hello world" snap
hello-huge     1.0      noise      -      A really big snap
hello-world    6.1      canonical  -      Hello world example

As long as you know the name of the snap you want, and it is public or your own private snap, you can install it using its name directly. But if you search the store, you’ll only see public, promoted results.

Install the snap you want. We’ll start with GNU Hello, from the Free Software Foundation:

$ snap install hello

Each snap might include multiple related commands, with a default command that has the same name as the snap itself. Additional commands are prefixed with the snap name:

$ hello
Hello, world!
$ hello.universe


Hello, universe!

Snaps can also install services that run in the background, such as web servers or content management systems. Those will start automatically when you install the snap.

See the snaps installed on your system with ‘snap list’, which will also tell you the software version, the unique revision, the developer of the installed snap, and any extra information such as whether the snap is in developer mode or not:

$ snap list
Name           Version               Rev  Developer  Notes
hello          2.10                  26   canonical  -
ubuntu-core    16.04+20160419.20-55  109  canonical  -
webdm          0.17                  21   canonical  -

Always fresh – update fast and reliably

Snaps are updated automatically in the background every day. You can manually get the latest version of all your snaps with snap refresh which will bring you completely up to date for all snaps, unless you specify particular snaps to refresh.

Release channels — stable, candidate, beta and edge

Developers can publish stable, release candidate, beta and edge versions of a snap, at the same time. This enables them to engage with users who are willing to test upcoming changes, and it enables users to decide how close to the leading edge of development they want to be.

By default, snaps are installed from the stable channel, but there is also a candidate channel which by convention will preview the next stable release, a beta channel and an edge channel.

$ snap refresh hello --channel=beta
Name    Version   Rev   Developer   Notes
hello   2.10.1    29    canonical   -
hello  (beta) installed

Run the beta version of the command:

$ hello
Hello, snap padawan!

Note that you could have directly installed hello from the beta channel via:

$ snap install hello --channel-beta

Developer mode

When a developer is working on a snap, they may want to let it run without the strict security confinement that is expected of stable, published snaps for general consumption. This is done by specifying --devmode on installation, to give permission for this snap to be run without that confinement.

Developers can publish snaps that require --devmode to work, but they can only publish those to beta or edge channels, not stable or candidate channels. As a user, you can install those beta or edge versions using --devmode as well. Bear in mind that you should NEVER do this unless you absolutely trust the developer with all the information on your system.

$ snap install flubber --channel=beta
Error: this version of foo requires devmode.
$ snap install flubber --channel=beta --devmode
WARNING: snaps installed in devmode are not confined. You are trusting
all the private data on this system to the developer "frankie".

Do you still want to install ‘flubber’? [y/N] N

Popular snaps

If you are running Ubuntu 16.04 LTS, you can try all of this without having to install snapd. Check out snaps on uappexplorer.com or just use the command line to install any of these great snaps:

  • icon

    Jenkins

  • icon

    htop

  • icon

    Notes

  • icon

    Cassandra

  • icon

    Freecad

  • icon

    Shout

  • icon

    moon-buggy

  • icon

    WebDM

  • icon

    Hangups

Creating snaps is easy!

Snaps have a very simple internal structure — you can easily craft them by hand! But the easiest way to build a snap is with snapcraft, which supports building from source and from existing packages. Snapcraft also handles publishing your snaps to the world. Read how to create a snap and join the snap crafting community — we have a fun crowd of people who hang out on the #snappy channel on Freenode or on snapcraft@lists.snapcraft.io.