How To Install Snap Packages and Use the Snap Package Manager Like A Ninja

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.

How To Install and Use Snap Package Manager Like A Ninja

How To Install and Use Snap Package Manager Like A Ninja

In order to find information about a package available via snap, use: snap info package_name

How To Install and Use Snap Package Manager Like A Ninja

Install packages:

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.

Install packages:

  • 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:

How To Install and Use Snap Package Manager Like A Ninja

How To Install and Use Snap Package Manager Like A Ninja

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.

How To Install and Use Snap Package Manager Like A Ninja

How To Install and Use Snap Package Manager Like A Ninja

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

How To Install and Use Snap Package Manager Like A Ninja

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

How To Install and Use Snap Package Manager Like A Ninja

To revert the package to its previous version: sudo snap revert package_name

How To Install and Use Snap Package Manager Like A Ninja

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

How To Install and Use Snap Package Manager Like A Ninja

How To Install and Use Snap Package Manager Like A Ninja

List all the latest snap changes from the system: sudo snap changes

How To Install and Use Snap Package Manager Like A Ninja

List all the packages installed via snap: sudo snap list

How To Install and Use Snap Package Manager Like A Ninja

Remove package installed via snap:

Packages can be easily removed from the system via: sudo snap remove package_name

How To Install and Use Snap Package Manager Like A Ninja

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.

Liked it? Take a second to support Geekster on Patreon!
Tagged with: , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

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

*

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!