Serverspace Black Friday
JT
July 8 2024
Updated July 12 2024

What is deb-packets, snap-packets and how that works?

Debian Maintenance Ubuntu

To work with the operating system, it is necessary to have a set of various applications and utilities, both user and administrative segments. There are many variations of installing the necessary software: instructions with compilers/interpreters, binary files, shell scripts and many others.

Nowadays, installation is a fairly simple and straightforward process for the user, where the installation is done with a single command. But this would not be possible without a specially designed mechanism of compressed archives called deb-packages, rpm-packages.

What is a deb package and how to use them?

The software is only possible thanks to binary files and instructions processed by compilers/interpreters. The first solution contains low-level machine code for operation and passes it through the kernel to the processor for execution. The second solution allows you to write an instruction in a human-understandable language, which is then converted into machine code and passed to the processor for processing. However, there are a lot of dependencies, configuration files, libraries, which must be unpacked and moved to the appropriate directories of the OS.

The user does not always know how to correctly deploy the software and configure it. For this purpose, various solutions have been developed to automate software deployment and provide a collection of necessary libraries. One of them is the deb package!

Deb-package is a compressed archive containing a collection of necessary components for the software and deployment scripts to automate their installation. The necessary package managers apt and dpkg already exist for working with this type of files, as they implement the unpacking mechanism.

Schema of deb
Screenshot №1 — Schema of deb

Logically, this architecture can be divided into several main groups: metadata and script files, binaries and libraries, configuration files, documentation. Let's consider each of the directories and describe the main functions:

  • /usr/(s)bin is the directory where all executable files, the so-called software kernel, are usually stored;
  • /usr/lib is a nearby directory that stores the necessary libraries for the application itself;
  • /etc often stores the necessary configuration files to set up the application/utility or system;
  • /usr/share/doc stores documentation and manuals of the software itself;
  • control, preinst, postinst, prerm and postrm files lie in the root of the folder. These are the files that define scenarios and necessary actions when the software is running. The control file contains a list of dependencies, counter-dependencies, names and other meta-data.

In fact, it is possible to package absolutely any file, as unpacking is just a predefined mechanism. In order to preview the structure of a package before installation, you need to write the command:

dpkg --content [deb-packet]
Content of deb
Screenshot №2 — Content of deb

You can use the command to view a list of dependencies and other metadata:

apt show [deb-packet]
Deb info
Screenshot №3 — Deb info

Packages are distributed openly through repositories, web and file servers, then installed using the apt and dpkg package managers.

All steps in the tutorial can be performed on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.

Create Server
Screenshot №4 — Create Server

It will take some time to deploy server capacity. After that you can connect in any of the convenient ways!

Why are Deb packages inconvenient and what is Snapd?

In practice, it is not always convenient to use DEB packages: the list of listed dependencies may not always be on the machine or repository, the presence of conflict of existing libraries and applications, the possibility of third-party software affecting applications and the lack of cross-platform.

Apt error
Screenshot №5 — Apt error

All these shortcomings can greatly affect devices that run information systems! An alternative solution has been presented by the developers of the Ubuntu distribution, a new package manager called snap!

Snap - is a package manager that uses virtualisation technologies, allowing you to run each of the utilities / applications in a separate container. For delivery the software immediately uses archives with all dependencies and libraries, as well as prepared OS with minimal requirements allows to make this solution cross-platform!

Snap's schema
Screenshot №6 — Snap's schema

The flowchart allows you to understand which main modules are used and how they interact. The snapd service is a background programme that is an abstract control panel for the package manager itself. It starts up first, then waits for user commands to enter, for example, consider:

snap install nmap

At this point snapd gets the command to search locally for the nmap package, if it doesn't find it it downloads it from the repository:

Snap install packet
Screenshot №7 — Snap install packet

Once the image has been acquired by the machine, snapd creates a separate namespace with file system, networking, process space, and appropriate user mapping. This environment is completely isolated from the host OS and communicates with the host system kernel. CGroups allows you to restrict the running environment and grant rights to interact with the host OS, using the command below let's see the main features of the nmap utility:

snap connections nmap
Snap connections
Screenshot №8 — Snap connections

There is access to the host network as well as files. The utility was installed on core-snap package, which is an OS with minimal requirements, making the process cross-platform. The main drawbacks of the package manager for deb format have been eliminated! It is currently one of the most interesting and safe alternatives to the package manager!

The packages presented in this manual are used as a way to transfer and install software for devices. Deb packages are a classic solution that has a number of disadvantages. Snap covers some of them and presents a richer functionality, however, not all software for this solution is implemented.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.