Snaps are basically an application compiled together with their dependencies and libraries – providing a sandboxed environment for the application to run. These are easier and faster to install, can receive the latest updates and are confined from the OS and other apps.
An application can be packaged for every Linux desktop, server, cloud or device in the form of snap. For an application developer, maintaining different package formats and subsequent updates is a pain, which Canonical has tried to overcome in the form of Snaps. It has worked well because more and more applications are now providing Snap packages.
In other words, instead of worrying about DEB packages for Debian/Ubuntu, RPM packages for Fedora, etc, you can use Snap package that would work on all Linux distributions with Snap support.
Advantages of snaps
- Easier to create and manage for Developers: Snaps are easier to create and contain all the dependencies and libraries needed to run, which also means the application uses the latest libraries and do not face any dependencies issues.
- Automatic Updates: Updates to a snap are delivered automatically daily, and reach out to everyone irrespective of the base OS.
- One snap for everything: be it a desktop, server or cloud.
- Different release availability: A snap can be maintained in the stable release, beta versions, and daily build at the same time and you can switch between each other whenever you want.
- Security: Snaps run in a sandboxed environment, isolated from the rest of your system.
How to install Snap on Linux
Before you Snap packages, you will have to install snapd. snapd is a management environment that handles installation and updates of snaps. Installing snapd will enable Snap support on your Linux distribution.
Let’s see how to install it for different Linux distributions.
Enabling Snap support on Debian and Ubuntu based distributions
If you want to use Snap applications on Linux Mint and other Debian or Ubuntu based distributions, use the command below:
sudo apt install snapd
Enabling Snap support on Fedora based distributions
sudo dnf install snapd
Enabling Snap support on Arch-based distributions
snapd is available in Arch User Repository. Run the below command to install and enable it.
yaourt -S snapd
sudo systemctl enable --now snapd.socket
Enabling Snap support on OpenSUSE based distributions
snapd is not officially included for OpenSUSE. To install in Tumbleweed use the below commands:
sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.2/ snappy
sudo zypper install snapd
Once the package is successfully installed from the community repo, enable the systemd unit.
sudo systemctl enable --now snapd.socket
How to use snap with the basic Snap commands
Once you are done with the snapd installation, it’s time to see how to use it. We have already covered Snap commands in detail. Here, I’ll just quickly list out the most useful Snap commands.
You can search different snaps and install it. There is a Snap store which holds different public and private apps (or snaps) for clouds, desktops, devices etc.
Finding a snap
Anyone can publish a snap in the store, however, you only see the snaps that are published to the stable release and has been reviewed. Use the below command to search for a snap:
sudo snap find libreoffice
Once you found the snap you are looking for, you can install it with the below command:
sudo snap install <snap_name>
List out installed snaps
You can use the below command to see the snaps you have installed along with their versions and the developer:
Update an installed snap app
Snaps are updated periodically to their latest version. In case you are trying to do it manually, type in the below command in the terminal:
sudo snap refresh <snap_name>
Uninstall a snap package
To remove a snap
sudo snap remove <snap_name>
With different Linux distributions running different package managers and formats, there is no single way of installing an application in every Linux distribution the same way. Snap can solve this problem, over-coming the installation issues (like a missing library) and ensuring you are running the latest version!
What do you think about snaps? Do tell us in the comments.