How To Install And Use The Snap Brand New Package Manager On Linux

Canonical has introduced a new packaging system called snap which was the future of Linux application packaging and bundled with Ubuntu 16.04 its one of the main feature.

What is Snap package?

Snap packages are secure, isolated from each other and the host system using technologies such as AppArmor.

It’s cross-platform, self-contained, allowing a developer to package the exact software their application needs.

This sandboxed isolation also improves security and allows applications, and whole snap-based systems, to be rolled back should an issue occur.

It has many advantages over the more traditional package formats such as .deb, .rpm, and others. Snaps use a special YAML formatted file named snapcraft.yaml. Snaps really are the future of Linux application packaging.

By default snap command line tools available for Ubuntu 16.04, If no, use below command to install it.

$ sudo apt install snapd

What is Snapcraft?

Snapcraft is described as a delightful packaging tool. It supports multiple build technologies and produces a .snap package with all its dependencies for Ubuntu Classic Desktop (using snapd). Simplenote is used to create snapcraft.yaml file.

Developers who want to create snap packages, they need to install snapcraft tool.

$ sudo apt-get install snapcraft

What is Simplenote?

Simplenote is an Electron-based note taking application that uses Simperium to sync notes across Android, iOS, Mac, and of course Ubuntu (and other Linux systems).

Which help us to create our initial snapcraft.yaml file in the Simplenote directory to tell Snapcraft how to package the application.

What is Simperium?

Simperium is a service for developers to move data everywhere it’s needed, instantly and automatically.

1) List available snap packages

Snap find will list all available snap packages on your system. As of now very less number of Snap packages are available and Ubuntu 16.04 widely using .deb packages, my guess canonical will push more snap packages on Ubuntu 16.04 for next update. So first find the list of available snap packages to experiment the snap command.

$ snap find
Name                       Version                    Price    Summary
alsa-utils                 1.1.0-1                    -        Utilities for configuring and using ALSA
apktool                    2.1.1                      -        A tool for reverse engineering 3rd party, closed, binary Android apps.
atom-cwayne                1.9.0                      -        Atom Text Editor
audovia                    3.2.8                      -        Database application for making music using JFugue MusicStrings
base                       16.04+20160525.05-00       -        Base content for snapd
beagleblack                3.1                        -        OEM Beagle Bone Black
canonical-dragon           0.7.1                      -        The gadget snap for the dragonboard
canonical-i386             3.2.i386                   -        The gadget snap for generic i386 systems
canonical-pc               3.2                        -        AMD64 generic package
canonical-pc-linux         4.4.0-18+20160419.13-26    -        The ubuntu-core kernel snap
canonical-pi2              3.2                        -        Raspberry Pi 2 support package
drmips                     2.0.1-3                    -        Educational MIPS simulator

2) Install snap packages

Package installation command are similar to other package managers such as apt, apt-get, yum, dnf, zypper, etc.,. Here i’m going to install links snap package.

$ sudo snap install links
[sudo] password for daygeek: 
1.51 MB / 1.51 MB [============================================================================================================] 100.00 % 341.88 KB/s 

Name   Version  Rev  Developer
links  2.12-1   2    zygoon

3) List installed snap packages

Use the below command to list installed snap packages on your system.

$ snap list
Name         Version               Rev  Developer
links        2.12-1                2    zygoon
ubuntu-core  16.04+20160531.11-56  122  canonical

4) Remove snap packages

Use the below command to remove the installed snap packages on your system.

$ sudo snap remove links


5) Find snap packages

Use the below command to search the particular snap packages on your system. In my case i’m going to search htop package.

$ snap find [search-term]
$ snap find htop
Name  Version  Summary
htop  2.0.1    Interactive processes viewer

6) Snap history

Use the below command to check the snap pacakges history.

$ snap changes
ID   Status  Spawn                 Ready                 Summary
1    Done    2016-06-07T12:53:24Z  2016-06-07T12:53:59Z  Install "links" snap
2    Done    2016-06-07T12:55:09Z  2016-06-07T12:55:10Z  Remove "links" snap

7) Upgrade Snap packages

Use the below command to upgrade one or more snap packages on your system.

$ sudo snap refresh [package-name]
$ sudo snap refresh links
error: cannot perform the following tasks:
- Download snap "links" from channel "stable" (revision 2 of snap "links" already installed)

8) Snap help

Use the below command to get more about snap packages on your system. Also use the second command to get more details about specific command.

$ snap --help
$ snap [command] --help

  abort       Abort a pending change
  ack         Adds an assertion to the system
  changes     List system changes
  connect     Connects a plug to a slot
  disconnect  Disconnects a plug from a slot
  find        Finds packages to install
  help        Help
  install     Install a snap to the system
  interfaces  Lists interfaces in the system
  known       Shows known assertions of the provided type
  list        List installed snaps
  login       Authenticates on snapd and the store
  logout      Log out of the store
  refresh     Refresh a snap in the system
  remove      Remove a snap from the system

Reference : Ubuntu Developer Page

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

8 Comments on “How To Install And Use The Snap Brand New Package Manager On Linux”

  1. OK, So how does snappy compare to and differ from apt, apt-get, yum, dnf, zypper, etc.? Why did they create this “new” way of doing things when the old way(s) seemed just fine? You say there are “many advatages”, but what are they? So far everything Ubuntu has forked has ended up in failure, except maybe Unity, but even then, I’ve never used it.

    1. Now Snap become Universal package manager (Snap can installable to all the Linux Distribution) and other distribution also adapted such as Arch, debian, fedora, Gentoo. Few distribution are testing on dev like RHEL, openSUSE….etc…

      1. Yes, but why is it superior? Why is snap a better way (besides cross platform). It needs more than that to succeed.

        1. One package for all distribution. Isolated from each other package and wont disturb Host System but have security risks on RPM based systems because we need to disable SELinux.

          1. Well I guess you haven’t read all they hype that this has caused. Ubuntu didn’t make this cross platform, they just said they did. They also have some other falsehoods in their press release that looked more like a fear tactic to try to beat others to the race. There are other competing “standards” that function just like Snappy does. Flatpak is one. Flatpak seems to work better, is further along in development and is more compatible with other distros than Snappy is.

Leave a Reply to 2daygeek Cancel reply

Your email address will not be published. Required fields are marked *