On Linux, there are many different ways to install software. There are Debian packages, Redhat RPM packages, the Arch Linux user repository, the Gentoo Portage tree, AppImages, tar.gz archives with static binary files, and the list goes on. Still, with as many ways to install software on Linux, there are still many problems present. For example: when developing professional software for Linux, it’s very hard to get it on every single Linux distribution. The people at Ubuntu are committed to solving this issue. Their solution ; Snap packages. Here’s a look at the need for Snap Packages on Linux, and how to use and install them.
Why Snap Packages Were Developed
Often times developers find themselves packaging their programs in many different package types, and get discouraged. It takes time to make all of these package files, and as a result, lots of programs don’t make it onto Linux. This is why the people at Ubuntu developed Snap packages. A snap is something that can be installed from the snap store, and inside the “snap” is everything the program is required to run.
This means that everything the app needs (libraries, binary files, image files, audio files and programs) are self contained and can run independent of the system. This ensures that no matter what, the program will run despite how outdated, or misconfigured the host system is. This Effectively makes it possible to install snaps on any Linux distribution, and makes it a “universal installer” that any developer, big or small, can pick up and even make their own snap store!
Installing Snapd and getting it running
Snapd is the technology that helps snaps run on Linux. The company behind snaps has worked with other Linux distribution makers so that the popular and most used Linuxes can run and install snaps with ease. Here’s how to get it running
Note: Ubuntu users, as well as those using a Linux distribution based on Ubuntu will not need to install Snapd.
sudo apt install snapd
sudo dnf install snapd sudo systemctl enable --now snapd.socket
sudo pacman -S snapd sudo systemctl enable --now snapd.socket
OpenSUSE Leap 42.2
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
sudo zypper addrepo http://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed/ snappy sudo zypper install snapd sudo systemctl enable --now snapd.socket
nano -w /etc/portage/repos.conf/gentoo-snappy.conf
Paste the following:
[gentoo-snappy] # An unofficial overlay that supports the installation of the "Snappy" backbone. # Maintainer: Clayton "kefnab" Dobbs (email@example.com) # Upstream Maintainer: Zygmunt "zyga" Krynicki (firstname.lastname@example.org) location = /usr/local/portage/gentoo-snappy sync-type = git sync-uri = https://github.com/zyga/gentoo-snappy.git priority = 50 auto-sync = yes
Save the configuration file with
ctrl + O.
emaint sync --repo gentoo-snappy
How To Use Snaps
As mentioned earlier, snaps are hosted in the “snap store” run by Ubuntu and Canonical respectively. Anyone can post a snap for free. For those looking to publish their own snap packages to the store, head over to Snapcraft.io. This website has all of the information (in heavy detail) that can get you started.
To search the store for software, try using the find command:
snap find programname
snap find telegram
This prints a list of all installable snap packages with the keyword “telegram” in it. Look through this list, and figure out what package to install. Then, use the install command to make it happen.
sudo snap install telegram-latest
This will download the latest version of the snap from the store, and install it to the system, and then mount the snap container so that the user can access the software inside of it. To view where the snap is mounted, run the
lsblk command. This is because the software is a mounted volume and no different for the system from any other mounted hard drive, or device.
Remove any installed snap package from the system with the remove command.
sudo snap remove telegram-latest
Forget the name of a snap you wish to remove? Try this:
The list command will print out a list of all installed snaps. From here, take note of the name of the snap, then remove it from the system with the remove command above.
Note: Find other commands not discussed in this tutorial by using
Like any software, snaps have to update. The snap daemon manages every snap container on the system. As a result, snap packages will not update with conventional means. To update installed snap packages on the system, use the refresh command. The last crucial command for using snaps is the refresh command.
sudo snap refresh
Snap packages have the potential to replace ways we install and use software on Linux, by making it easier to distribute. Instead of software developers having to create several different packages, binaries and delivery methods to accomplish the same task, they’ll just create a single snap container. Self contained with libraries, executable code, and other important files that users can easily install with a single command.
Snaps aren’t perfect. Some new Linux users will have issues using them. This is because installing apps will only work with the command line. We can only hope that as snap packages get more and more popular, the people at Ubuntu will work on a nice user interface to install and use snaps. Till then, the command line will have to do.