New to Linux and the open source world? We have compiled a huge list of resources to help you go through Linux and its distributions. Visit the full Linux guide page right now.
75% of users are still depending on traditional package mangers (APT, DNF… etc) instead of using Snaps or Flatpaks, but this is gradually starting to change, as larger organizations and development communities start to use the latter instead of the former.
Some people like Snaps, some people hate them, which is fine, just like most things in life. However, it is important to balance this love-hate relationship in order to not be biased toward a certain direction, ignoring the other.
What are Snap Packages?
Snap is a new app format for building and distributing applications in the Linux world. Canonical, the company behind Ubuntu, developed it and started shipping it by default since Ubuntu 16.04.
Historically, the Linux community was kind of mixed in its opinion about Snaps. On one hand, they make the process of building and distributing applications for various Linux distributions quite easy and trivial. On another hand, they take too much time to initially start, they consume resources and the central Snap distribution (Snap Store) is closed-source and proprietary.
The issues of Snaps are well-known and defined in the community, and do not need to be emphasized more. But in today’s article we’ll see some good use cases of Snaps and how they are easing the life of users and developers across many fields in the open source world.
Insightful Use Cases for Snaps
SSL Automatic Renewal for Let’s Encrypt
Let’s Encrypt is a famous initiative to transform the Internet from HTTP protocol to HTTPS; Ensuring the security of connections between websites and Internet users. They are giving free SSL certificates for free, for everyone and for whatever domain names you may have in your pocket. The duration of each SSL certificate is 90 days, which you can renew indefinitely for free as well whenever it reaches its end.
To do that, users install what’s known as “Certbot” on their servers, which is the certification distribution program designed by EFF that obtains and deploys the SSL certificates automatically on whatever web server users may be using (E.g nginx/Apache2). In just few commands, users can instantly switch from HTTP to HTTPS.
But what most people don’t know is that, for some quite time now, Certbot’s default installation method was switched from traditional packages (DEB/RPM) into Snaps by default.
This, in turn, contained a nice addition: The Certbot Snap is pre-configured to automatically renew the SSL certificate once the 90 days period gets to an end, without any input or intervention from the user’s side. After just running the first
certbot-auto command to initiate the first SSL certificates for the specified domain names, Certbot will be automatically renewing all the needed SSL certificates when they reach their corresponding expiration date.
While it sounds like a simple thing in theory, it would have been much of a headache to do that configuration using Systemd/Cron on all the servers one may be owning, and for all the domain names, and on various Linux distributions via traditional package management. Updating these packages to their latest versions could have been an extra effort as well.
By using Snaps, Certbot will be automatically updated to the latest newer versions whenever they are available, plus the deployed SSL certificates will be automatically renewed. The same Snap package running on Ubuntu is the same one running on Fedora and openSUSE, saving both users and developers time needed to deploy the software and use it.
Configuring such automatic updates and automatic renewals using traditional package managers could have been possible as well for sure, but the effort needed to maintain the packages updates and make sure they work with X and Y versions of each different Linux distribution could have been much harder for the developers. Instead, they just ship one version for everyone which contains all the needed dependencies and configurations inside the Snap package itself. (A kind reminder here that Flatpaks do not even work on servers)
Plug-and-Play Databases: CouchDB
CouchDB is one of the NoSQL databases. It is very lightweight and effective database management system written in Erlang. It provides traditional installation options beside a Snap package.
What is very convenient about the CouchDB Snap is that it is a plug-and-play package: You run
snap install couchdb, and then you see it running on
No need to add keys, repositories, system services, configurations… Nothing at all.
While Canonical has been heavily criticized for keeping the Snap Store proprietary, and while this could indeed be a bad thing, it still has some positive effects, such as the beauty of having a centralized place where you install anything you want in one command, and from whatever vendor.
People often look to the downsides of having a proprietary, centralized software store for distributing Snaps, forgetting the other possible benefits it is bringing to the table. Being able to instantly retrieve the latest versions of any software you want using a single command without having to even look for their installation commands on the Internet is a very life-easing feature. You just enter “snap install couchdb” and Voala! it is now on fully running on your machine.
This is quite different in the case of many types of other software. Wine for example requires that you first enable the i368 architecture packages on your Ubuntu system:
sudo dpkg --add-architecture i386
And then you have to add the needed keys:
wget -nc https://dl.winehq.org/wine-builds/winehq.key sudo apt-key add winehq.key
And then you have to add the repository suitable for your Linux distribution:
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
Only now you’ll be able to install the latest version using:
sudo apt install winehq-stable
And then developers will have to maintain these repositories for every Linux distribution they want to support.
Instead of that, with Snaps, they could just release one package which is instantly installable in one command for their users, on all Linux distributions.
PyCharm: Continuously Updating IDE
PyCharm is one of the most well-known IDEs in the market. It is used by software developers to develop programs using the Python programming language.
It was interesting to know that PyCharm developers have started to officially support and endorse Snap installation on their website for some time now.
Snaps allow their users to install the IDE in a single command:
sudo snap install pycharm-community --classic
Later on, whenever there is an update to PyCharm, users will be able to see it via a popup in the software itself:
Snaps are always auto-updating by default, ensuring users will always end up using the latest version of the software whenever a new version is available. To do that, the Snap daemon running in the background will download the updates whenever possible and install them automatically, without any intervention from the users’ side.
It would have been quite a pain to build/install PyCharm from the .tar.gz archive they are providing on their website each time a new version is released. But thanks to Snaps, users are not even aware that they are always running the latest versions, all the time.
To sum up, there are many beneficial use cases where using Snaps is quite fantastic for the average Joe. Whether on servers or desktop machines, Snaps do add value to the overall operating system user experience, thanks to the way they were designed.
This isn’t to say that Snaps are absolutely great and that they do not lack any issues at all; Some issues about Snaps are quite real, such as the starting time, resource consumption and performance issues. Issues which need to be solved in order for a larger adaptation of Snaps to occur.
Still, in their current form and shape, Snaps are easing the lives of both users and developers, and all this directed hate towards them sounds too irrational and biased.