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.
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
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 Done
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
$ 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 or $ 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