Ubuntu Snap Packages: Complete guide to snap package management tool
Traditionally, we have different Linux distributions using different package format and it has been a problem for both developers and users. Debian based distributions use deb packages, redhat based distributions use rpm packages while there are many other Linux variants using their own package format.
Snappy is a universal package format introduced by canonical, the same company behind the Ubuntu operating system. The goal of the snap is to provide a universal package format that works across all Linux distributions.
In this tutorial we will learn how to use snap package manager in Ubuntu to install, configure, update and remove software and applications.
Install, configure, update and remove snap packages
The snap command is the command line tool to Install, configure, update and remove snap packages in Ubuntu. The command is very is to understand and have all the necessary features.
Snap has been installed by default in both Ubuntu 18.04 and 16.04 LTS. On 14.04, you can install snap with apt-get command:
sudo apt-get install snapd
Note that, snap packages are also available in the Ubuntu software center, but the software center does not have a way to filter between deb and snap applications.
Searching for packages
A good package manager should have an option to search softwares by keyword and it is very important, especially when you don't know the exact name of the software you need to install. In snap this done by using the find command.
sudo snap find vlc
In the above example, we searched vlc and the command will output all the packages that are related to the vlc.
As shown in the above screenshot, the search result includes the package name, currently available version, developer and the short description about the software.
If you want to get more details on a single package, run the info command:
sudo snap info vlc
Installing and removing software
Once you know the package name, you can use install command to install it:
sudo snap install vlc
If you want to remove a software, use the remove command:
sudo snap remove vlc
By default snap command install snaps from the stable channel. The stable channel contains the stable and tested versions of the software. Available channels are stable, candidate, beta and edge.
- stable - Provides stable and tested version of the Software.
- candidate - Provides a heads-up of a new stable revision, Tested, but not quite ready to be released as a stable version.
- beta - used to provide preview releases of tested changes.
- edge - Latest version, probably untested and with no guarantees attached.
For example, you can install the beta version of the VLC media player with --beta option:
sudo snap install vlc --edge
If you experience any problems with your installed version, then you can change to the stable version with refresh command:
snap refresh vlc --stable
Updating packages to the latest version
By default, Ubuntu snap packages are updated automatically in the background. But you can use refresh command to update apps manually.
If you don't specify the package name, all snaps in the system will be updated. For example:
sudo snap refresh
Will update all snap packages to the latest version.
sudo snap refresh nmap
Will update Nmap (Network Mapper) to the latest version.
By default updates are done from the stable channel, But options are available to update from a different channel.
- --stable - Install the updates from the stable channel (Default).
- --candidate - Updates from the candidate channel.
- --beta - Update to the latest beta version.
- --edge - Install the updates from the edge channel
For example, following command will update VLC media player to the latest available beta release.
sudo snap refresh vlc --beta
If you experience any problems with the updated version, then you can roll back to the previous version with revert command:
sudo snap revert vlc
View details about installed packages
Run the list command to list all installed snap applications on your Ubuntu system:
snap list
The command output includes software name, version, the unique revision and the developer.
Enabling and disabling snaps
One other feature of snapd is, it allows to enable and disable apps very easily. For example, following command will disable the VLC media player and the player won't be available to use until re enable it.
sudo snap disable vlc
the snap can easily be enabled again with the enable command:
sudo snap enable vlc
That is basically all you need to know to get started with Ubuntu snap package management tool.
Will snap replace the apt package manager?
The snap is not designed to replace apt, at least not yet. As a debian based Linux distro, Ubuntu inherits the debian package format and apt package manager to manage deb packages, and will continue to do so. The apt is a stable and very reliable package manager.
Snappy is a universal package format introduced by canonical the same company behind the Ubuntu operating system. Snaps are self-contained and Snap packages operate independently of system packages, so users can install a Snap package in Ubuntu without disturbing the system packages.
Basically, you could install the a deb and a snap of a same software and run side by side (The snap version will be the default unless you change the default).
Snappy is best for the Ubuntu desktop where you want to try the latest version of a software, while you should use the apt package manager on Ubuntu server where you want install stable and most secure software and applications.