Читать книгу Mastering Linux System Administration - Richard Blum - Страница 65

Using Snap Containers

Оглавление

Canonical, the creators of the Ubuntu Linux distribution, has developed an application container format called snap. The snap packaging system bundles all the files required for an application into a single snap distribution file. The difference between a snap package and a dpkg package is that snap packages don't have any dependencies—all of the files needed to run an application are in the package installation. This can create duplication of files that could be shared with other applications, but it also resolves any issues that could occur from conflicting library files installed by multiple packages.

The snapd application manages the snap packages installed on the system and runs in the background. You use the snap command‐line tool to query the snap database to display installed snap packages, as well as to install, upgrade, and remove snap packages.

To check whether snap is running on your system, use the snap version command.

$ snap version snap 2.47.1+20.04 snapd 2.47.1+20.04 series 16 ubuntu 20.04 kernel 5.4.0-53-generic $

If snap is running, you can see a list of the currently installed snap applications by using the snap list command.

$ snap list Name Version Rev Tracking Publisher Notes core18 20200929 1932 latest/stable canonical* base lxd 4.0.4 18150 4.0/stable/… canonical* - snapd 2.47.1 9721 latest/stable canonical* snapd $

To search the snap repository for new applications, use the snap find command.

$ snap find stress-ng Name Version Publisher Notes Summary stress-ng V0.11.24 cking-kernel-tools - A tool to load, stress test and benchmark a computer system $

To view more information about a snap application (snap for short), use the snap info command.

$ snap info stress-ng name: stress-ng summary: A tool to load, stress test and benchmark a computer system publisher: Colin King (cking-kernel-tools) store-url: https://snapcraft.io/stress-ng contact: colin.king@canonical.com license: GPL-2.0 description: | stress-ng can stress various subsystems of a computer. It can stress load CPU, cache, disk, memory, socket and pipe I/O, scheduling and much more. stress-ng is a re-write of the original stress tool by Amos Waterland but has many additional features such as specifying the number of bogo operations to run, execution metrics, a stress verification on memory and compute operations and considerably more stress mechanisms. snap-id: YMJsyW4vySPdys8BCA7jx8UiOVSVhUT6 channels: latest/stable: V0.11.24 2020-11-13 (5273) 3MB - latest/candidate: V0.11.24 2020-11-13 (5273) 3MB - latest/beta: V0.11.24 2020-11-13 (5273) 3MB - latest/edge: V0.11.24-44-20201121-7613-g2627a 2020-11-21 (5298) 3MB – $

To install a new snap, use the snap install command as the root user (or with root privileges).

Mastering Linux System Administration

Подняться наверх