Installing software on Linux: package managers, Flatpak and Snap explained

TUREFF• •0
Coming from Windows or macOS, the way Linux handles software can feel strange at first. Instead of downloading an installer from a website, you usually get programs from a trusted repository run by your distribution. Once it clicks, it is often easier than what you are used to, and safer too. This guide explains the three main routes and how to choose between them.

The traditional route: your distribution's package manager

Every mainstream distribution has a package manager that downloads software from the distribution's own repositories, checks it has not been tampered with and keeps it updated alongside the rest of the system.
  • Debian, Ubuntu and Linux Mint use APT, with packages in the .deb format. In a terminal, 'sudo apt install' followed by the package name installs something, and 'sudo apt remove' takes it away.
  • Fedora uses DNF with .rpm packages, in the form 'sudo dnf install' and a package name.
  • Arch Linux and its relatives use pacman.
  • openSUSE uses zypper.
The big advantage is that one command or one click in the software centre updates everything you installed this way, and the packages have been built and checked by the distribution's maintainers. The trade-off is that a distribution with a fixed release cycle may offer an older version of an application than the developer's latest.

Software centres: the friendly front end

Most desktop distributions ship a graphical store, such as GNOME Software, KDE Discover or Ubuntu's App Center. These are front ends: behind the scenes they install from the package manager, Flatpak or Snap. Many stores show which source an app comes from, and it is worth looking, because the same program can appear more than once from different sources.

Flatpak

Flatpak is a distribution-independent format. An app packaged once runs on Fedora, Mint, Debian and many others.
  • Flathub is the main public repository of Flatpak apps. Some distributions enable it out of the box; on others you add it once by following the setup page for your distribution.
  • Apps run in a sandbox with a set of permissions, such as access to your home folder, the network or the camera. A permissions manager tool lets you review and tighten them.
  • Runtimes are shared, so the first Flatpak you install may download a large base runtime, while later ones are smaller.
  • Updates come through the software centre or the 'flatpak update' command.
Flatpak is popular for desktop applications where you want a recent version on a stable base system.

Snap

Snap is Canonical's universal package format and is built into Ubuntu.
  • The Snap Store is the central repository, run by Canonical.
  • Snaps update themselves automatically in the background by default, and you can defer updates for a while if needed.
  • Snaps are confined to varying degrees, with interfaces controlling what they can reach.
  • Snaps are not limited to desktop apps: they are also used for command-line tools and server software.
On Ubuntu, some apps you might expect as ordinary packages, such as the Firefox browser, are delivered as snaps. Other distributions can install snapd, though not all enable it by default, and some, such as Linux Mint, have chosen not to.

AppImage and other routes

  • AppImage is a single file you download, mark as executable and run. It needs no installation, but it usually does not update itself and is not sandboxed, so download only from the developer's official site.
  • Developer repositories, such as a vendor's own APT or DNF repository, give you official builds that update with the system. Add them only for well-known vendors, because a repository can install anything with full privileges.
  • Building from source is rarely necessary for everyday software.

Which should you use?

  1. Try your distribution's repositories first, especially for system tools, drivers and command-line programs.
  2. Use Flatpak or Snap for desktop apps when you need a newer version or the app is not packaged for your distribution.
  3. Avoid random scripts and installers from forums that ask you to paste commands you do not understand.
  4. Stick to one source per app where you can, so you do not end up with two copies updating differently.

Keeping things tidy

  • Remove what you do not use, through the store or the matching remove command.
  • Clear unused Flatpak runtimes with 'flatpak uninstall --unused' now and then.
  • Check each source is updating, because the package manager, Flatpak and Snap each keep their own list.
Which way of installing software do you prefer on your distribution, and why? Share your setup in the comments.

Comments (0)