Which package manager to use and when

IT teams running workloads on Ubuntu Linux have not one but two software package managers to work with: snap and apt.

Although both snap and apt automate the installation, management, and removal of software packages, they work in different ways. A company’s decision between snap or apt depends on its IT priorities.

What are snap packs?

Snap is a package management system from Canonical, the company that develops the Ubuntu Linux distribution. Snapcraft is the formal name of the system that manages snap packages, but the system is commonly referred to as snap. Although Snap was developed for Ubuntu, it was extended in 2016 to support most mainstream Linux distributions.

Snap packages an application as an archive that contains the binary code, data, and libraries needed to run the application, including any external dependencies.

When you run the application, Snap unpacks the archive and the application runs in a sandbox environment – similar but not identical to a Docker container.

For example, to install the Gedit text editor, you would use the following command.

snap install gedit

When you run this command, snap will download the gedit snap package from the snap repositories configured for your system. You can also remove installed snap packages with remove snap gedit Command.

What is suitable?

Apt is a Linux package management tool used on Ubuntu and a variety of other Linux distributions. apt was introduced in 1998 and has grown into a widely supported, popular option for installing, updating, and removing Linux software.

Apt manages Debian packages, known as debs. Like Snaps, each deb contains the application code, data, and libraries needed to install an application. Debs also define the application’s dependencies, such as: B. any other software that the application needs to run. When you install a Debian package via apt, apt automatically installs the application’s dependencies.

Apt permanently installs data into the Ubuntu file system from which the applications run. The applications run as standard processes directly on the host system and not in sandbox environments.

And like Snap, apt installs packages with simple commands.

apt install gedit

Uninstall the package with the suitable to remove gedit Command.

Differences between snap and apt

Snap and apt appear to be similar on the surface: both allow application management via packages and allow you to install and remove software with simple commands. In fact, many snap and apt commands, such as To install and Extinguish commands are identical.

Snap and Apt differ in how they package software.

However, where Snap and Apt differ is how they package software. Snap includes everything needed to run an application – including its dependencies – in a single package, but apt expects users to provide dependencies as separate packages alongside the app package.

This might seem like a small difference, but it has several important implications for how Snap and Apt software work:

  • software versions. Apt installs software directly onto your system, so you can only install one version of each application you use. While there are ways to manage conflicting application versions with apt, it’s not a clear or easy process. Snap makes it easy to install multiple application versions on the same system.
  • packaging. Snap packages are easier to build than apt packages because you can bundle the dependencies in the package instead of defining them and expecting the user’s system to have the right dependencies.
  • packet removal. Because all application data and dependencies are self-contained in a snap package, you can remove the entire application by removing the snap. Although apt also removes all data associated with an application, in most cases there is a risk that when you remove an application, apt cannot delete some data. This leaves Cruft on your system.
  • Security. In a way, snaps are more secure as they can be run without root privileges, although by default snap expects root privileges to install snap packages on your system. Debs require root privileges. It is theoretically possible to unpack a Debian package and run the data as a non-root user, but the packages won’t work that way and it will generate a plethora of errors and problems.

In all these aspects, Snap makes for cleaner and easier software management. On the other hand, apt packages also have their advantages. For one, they are smaller because they don’t bundle dependencies. Installing software with apt results in more efficient use of disk space. Applications installed via apt are also likely to start faster since the application packages do not need to be decompressed before running; Instead, the packages are decompressed at install time.

Also, apt is an older, widely used package management system that has some advantages. Snap is primarily associated with Ubuntu at the time of release, and while it can run on other distros, it’s not installed by default. If you want to create packages that can be used across multiple Linux distributions, apt is a better choice.

When to use snap vs apt?

Snap is a good choice for IT operations teams whose primary package management needs revolve around internally built software. Because Snap simplifies packaging and provides more control over package management and performance, this results in a smoother overall experience for IT teams who need to build and deploy software, such as: B. A combined DevOps team. Snap is also an option for use cases where, as mentioned above, an IT team cannot run software as the root user for security reasons.

Apt makes sense when most of the software you run on Ubuntu is from third parties. Apt is also a better choice for companies running multiple flavors of Linux, as most Linux distributions support apt.

But you can also use snap and apt at the same time. You can work on the same system, but installing the same software in Snap and Debian packages wastes resources.

About Willie Ash

Check Also

MediaTek Genio 1200 Linux System-on-Module supports Cortex-A78/A55 AIoT development kit

ADLINK Technology just introduced the SMARC 2.1 compliant LEC-MTK-I12000 System-on-Module (SoM) powered by a MediaTek …