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.
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:
You can use the command to view a list of dependencies and other metadata:
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.
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.
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!
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:
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:
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:
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.