Snap (also known as Snappy) is a software deployment and package management system built by Canonical. The packages, are usually called ‘snaps’ and the tool for using them is called ‘snapd’, which works across a range of Linux distributions and therefore allows distro-agnostic upstream software deployment.
“Snap” application packages of software are self-contained and work across all Linux distributions, thereby, enabling secure distribution of the latest apps and utilities for cloud, servers, desktops and the internet of things. So it does the same thing
apt-get but in different way.
Snapd is a REST API daemon for managing snap packages. Users can interact with it by using the snap client, which is part of the same package. You can package any app for every Linux desktop, server, cloud or device.
To complete this guide, you’ll need any supported GNU/Linux distribution/Ubuntu and also some very basic knowledge of command line use. This guide is focused on setting up and using the snap commands.
In case you’re using Ubuntu 16.04 LTS (Xenial Xerus) or later, including the latest Ubuntu 18.04 LTS (Bionic Beaver), you don’t need to do anything. Snap is already installed and ready to go. So if you are using any version below or your snap is not installed, you’ll need to install to start using it.
You can install it with the command below:
$ sudo apt update
$ sudo apt install snapd
snapd is up and running now, so let’s start using it!
Searching for snaps (apps/packages)
With the snap tool, you can search for available snap apps/packages. To find Snap packages , use the following command:
$ snap find <search_text>
Installing snaps apps
You can install any apps/packages available on snap with the command line below:
$ sudo snap install <package>
You can also specify the channel you want to install it from. Channel is snap concept that stands for the release of a snap.
$ sudo snap install --channel=edge <package>
Running installed snaps
Installed snaps are available under the
bin/snap and are usually added to the
$PATH. This makes it easily accessible from the command. You can run a snap app from the command line by just calling the command:
You can also run it from:
See a list of installed apps
You can see a list of all the installed snaps with the command line below:
$ snap list
Updating Installed Snaps (apps/packages)
Snaps are updated automatically be default and you can also update it manually using the command below:
$ sudo snap refresh <package>
To see which Snap packages have updates ready to be installed, you can use the command below:
$ sudo snap refresh --list
Downgrading Installed Snaps (apps/packages)
For some reason, if you did not like a recent updated Snap package, you can revert it to the previously installed version with this command:
$ sudo snap revert <package>
This will revert both the snap revision and the data associated with the software. If the previously used revision of the snap is from a different channel, that snap will be installed but the channel being tracked won’t change.
Removing Installed Snaps (apps/packages)
In case you’d like to get rid of snaps, you can remove a Snap package using this command:
sudo snap remove <package>
With this single command, application code, its run time dependencies and associated user data are all cleaned up. If your snap declared a service, they will as well be shut down and removed.
Enabling and Disabling Snaps (apps/packages)
In case you don’t want a snap to be available temporarily, you just disable it and enable it back when you need it.
$ sudo snap disable <package>
<package> disabled$ sudo snap enable <package>
Showing a list of running services
You can use
snap services to lists all the services added to the system by the currently installed and enabled snaps.
$ sudo snap services lxd Service
Startup Current lxd.daemon enabled active
Restarting, Starting and Stopping snap services
Services are restarted using the
snap restart <snap name> command.
By default, all services for a specified snap will be restarted:
$ sudo snap restart lxd
You can start a previously stopped services using the below:
$ sudo snap start lxd.daemon
You can stop a running services using the following command:
$ sudo snap stop lxd.daemon
Set and Get Snaps Configurations
Some snaps, such as those providing a background service, expose configuration options that can be altered.
The commands for viewing and changing these configuration options are
To see the configuration options exposed by an installed snap, enter
snap get <package>:
$ sudo snap get <package>
To change a configuration option, use the `snap set`:
$ sudo snap set <package> key=value
Download and Install Snap apps offline
You can also install Snap applications without internet. To do that, you’ll need to download the snaps (apps/packages) files. You can do that using the command below:
snap download <package>
The above command will download a .assert and a .snap file. You can just copy these files to other Linux/Ubuntu system which is not connected to the internet. Then you can install it using the command:
snap ack <package.assert>
snap install <package.snap>
Even though it still under development and there are not much snaps apps/packages available, it still one of the best software management system. Snap adoption has picked up speed, especially when Canonical is pushing for it so hard.