As you may know, Canonical had big plans to conquer the mobile phone marketing and so, they have developed the snap packages, which are packed with the dependencies built in, so that they can be easily installed on many Linux systems. The tool that handles the snap packages is called snapd and works across many Linux distributions.
While the Ubuntu Touch project is not maintained by Canonical anymore, the snap packaging format is still being developed and maintained.
Main advantages of the snap packages:
- snap packages provide enhanced security – they run inside a sandboxed environment, not affecting the main OS.
- snap apps are available via different channels – stable, beta, daily builds – permitting the users to test them without affecting their main OS
- snap packages get automatic updates – updates are delivered automatically
- snap packages are cross-platform – due to the fact that the snap packages come with builtin dependencies and are installed in a sandboxed environment, they are compatible with many Linux systems
- snap packages can be easily packaged and managed – it is easy for the developers to distribute their apps to the community
How to install the snapd package manager:
In order to use the snap packages on your Linux distribution, you need to install the snapd package, which permits you to install and manage snap packages.
Install snapd on Ubuntu 16.04, Debian Sid and newer:
$ sudo apt update
$ sudo apt install snapd
Install and enables snapd on Arch Linux and Manjaro:
$ sudo pacman -S snapd
$ sudo systemctl enable --now snapd.socket
Install snapd on Fedora:
$ sudo dnf install snapd
Install snapd on OpenSUSE:
$ sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.2/ snappy
$ sudo zypper install snapd
$ sudo systemctl enable --now snapd.socket
How to use the snapd package manager:
Search for packages:
In order to search for snap packages, you can either visit the snapcraft.io app store or to use the command-line interface. The Snapcraft Store groups the applications into different categories, including Developers, Games, Social Networking, Productivity, Graphics, Servers and many others.
Via the command-line, the syntax is snap find package_name .
In the below 2 examples, I have search the default snap repos for Atom and Brackets, two awesome text editors.
In order to find information about a package available via snap, use: snap info package_name
First of all, you need to be aware of the development channels available for snap:
- stable: the stable version of an app
- candidate: the release candidate versions are the ones will become stable
- beta: the beta channel hosts under-development apps that still receive new features
- edge: daily iterations of an app
- classic: this is not a development channel; the software that makes changes to the system can be installed via snap (if it is available via the repo) but with the –classic flag.
- stable (the –stable flag is not mandatory): sudo snap install package_name –stable
- candidate: sudo snap install package_name –candidate
- beta: sudo snap install package_name –beta
- edge: sudo snap install package_name –edge
- classic: sudo snap install package_name –classic
By default, the snap package manager searches for software in their stable branch, but if it does not find, it notifies the user:
The –classic flag:
For example, atom and brackets are not packed as applications that can be installed in an isolated sandbox, so they may make global changes to your system. When you try to install such packages, you will get notified to use the –classic argument, if you still want to proceed.
Upgrade all snap packages, list all snap packages available for upgrade and upgrade individual packages:
By default, the snap package manager searches by itself for updates and upgrades all the snap packages available in the system.
Upgrade all the snap packages: sudo snap refresh
To list all the snap packages that have updates: sudo snap refresh –list
To update a package to its latest snap version: sudo snap refresh package_name
To revert the package to its previous version: sudo snap revert package_name
Change package from a development channel to another:
In order to change a package from a development channel to another, you will need to use the below command: sudo snap refresh package_name –channel=channel_name
OR: sudo snap refresh package_name –channel_name
List all the latest snap changes from the system: sudo snap changes
List all the packages installed via snap: sudo snap list
Remove package installed via snap:
Packages can be easily removed from the system via: sudo snap remove package_name
After you have installed a snap package, you can easily open the application via either the terminal or by using your operating system’s menu or app launcher. To my mind, the snap packages are among the best things that happened to the *Nix universe, due to the fact that they will encourage the developers and big companies to create apps for Linux and will provide an easy method for everybody to install and use Linux apps.