posts
Guide to Linux package management

Guide to Linux package management

May 4, 2023
Dmitry Chuyko
12.9

A plain sandwich satisfies immediate hunger, but more sophisticated dishes usually require a lengthy list of ingredients. The same goes for application development on Linux — the more advanced your needs, the more libraries you must utilize. And to think that many of these libraries require additional dependencies… Quite a challenge!

But don’t worry; we prepared a concise guide to the way libraries are managed in Linux so that you get a good understanding of how to put together a perfect OS for your application!

How we manage packages in Linux: key notions

Software for Linux systems is distributed in the form of packages. A package is an archive with software files, configuration files, and a list of required dependencies — additional packages required for the software to run. Note that there are direct and indirect dependencies. Direct dependencies are essential for normal package functioning, whereas indirect ones are optional and could be beneficial for better software performance. When you install, upgrade, or delete a package, you may need to do the same to its dependencies.

Linux packages are stored in repositories hosted on a remote server. Usually, Linux providers have their own repositories divided into groups with essential software and auxiliary tools, but the actual classification depends on the vendor.

Keeping track of packages, their dependencies, and timely updates is hard. Fortunately, package managers shipped with every Linux distro simplify these tasks. A package manager is a utility that automates the process of obtaining, installing, and otherwise managing packages and their dependencies. For instance, developers can update all software simultaneously or particular packages only. In addition, there’s no need for manual installation of dependencies. A package manager scans the metadata provided with a package and downloads all required software. Most package managers install all dependencies by default.

A comparison of Linux package managers

There are multiple package managers in the Linux world, but developers can’t choose them because they are pre-built into a Linux distribution. We will summarize five package managers in the most popular Linux server/cloud distributions.

 

Linux distributions

File format

Command

Special features

APT

Ubuntu

Debian

.deb

apt

Optional menu-driven interface

YUM

RHEL/CentOS 7

Fedora 21

.rpm

yum

Dependency resolution

DNF

RHEL/CentOS 8

Fedora 22

.rpm

dnf or yum

Enhanced YUM with better performance

APK

Alpine

Alpaquita

.apk

apk

Lightweight

Zypper

openSUSE

.rpm

zypper

Can add repositories specified by URI

Linux package management on practice with Alpaquita

Alpaquita base image is delightfully minuscule, only 3.32MB (musl) and 8.4MB (glibc). The base image can be utilized for simple deployment scenarios or as a minimal starting foundation for a service or a containerized application. In addition, when developing an application for further dockerization, developers can add any required packages from Linux repositories, thus keeping the final Docker image lean and perfectly tailored to their needs.

What packages are available in Alpaquita

All Alpaquita packages are organized in two repositories: core and universe. Each of them has two branches, for musl and glibc libc.

The core repository contains all main tools and libraries, whereas the universe repository includes extra utilities for various purposes. When writing this article, the repositories contained 3 806 packages altogether, so we do not intend to name them all here. Instead, we will divide the software into several major groups and give a few examples so that the readers better understand what Alpaquita offers.

The most commonly utilized packages can be classified as follows:

  • Development
    • Java packages and tools (the packages include Java versions 8, 11, and 17, and JDK and JRE)

apache-ant: a java-based build tool

async-profiler: low overhead sampling profiler for Java

jattach: JVM dynamic attach utility

maven: a Java project management and project comprehension tool

    • Python packages and tools (numerous tools are provided in the repository, we give just a couple of examples)

py3-attrs: Python classes without boilerplate 

py3-pytest: Python3 testing library

py-gdbm: GNU dbm database support for Python

python3: Python programming language

    • GCC compiler, tools, and libraries for C/C++

atf: libraries to write tests in C, C++ and shell

g++: GNU C++ standard library and compiler

gcc: the GNU Compiler Collection

libgccjit: GCC JIT Library

libstdc++: GNU C++ standard runtime library

swig: a compiler that makes it easy to integrate C and C++ code with scripting languages

  • Administration

busybox: modular toolbox of common UNIX utilities

coreutils: GNU core utilities

shadow: PAM-using login and passwd utilities (usermod, useradd, ...)

util-linux: Linux utilities

  • Debugging

gdb: the GNU Debugger

linux-lts-debug: Alpaquita Linux LTS kernel

strace: diagnostic, debugging, and instructional userspace tracer

xkbcli: xkb command-line tool with interactive debugger

  • Deployment

cloud-init: cloud instance init scripts

cloud-utils: utilities for interacting with cloud VM images

nodejs: JavaScript runtime built on V8 engine, LTS version

py3-pip: tool for installing and managing Python packages

skopeo: work with remote images registries (retrieving information, images, signing content)

  • Software for the host system

docker: pack, ship, and run any application as a lightweight container

nginx: HTTP and reverse proxy server (stable version)

podman: simple management tool for pods, containers, and images

qemu: a generic machine emulator and virtualizer

vte3: Virtual Terminal Emulator library

  • Security

apparmor: Linux application security framework (mandatory access control for programs)

argon2: password-hashing utility

audit: user space tools for kernel auditing

cryptsetup: block devices encryption utility

cyrus-sasl: Cyrus Simple Authentication Service Layer (SASL)

gnutls: the GNU TLS library

heimdal: Kerberos 5 and security software

krb5: the Kerberos 5 implementation

libressl: version of the TLS/crypto stack forked from OpenSSL

libsasl: Cyrus Simple Authentication and Security Layer (SASL) library

nghttp2: HTTP/2 implementation

numactl: simple NUMA policy support

oath-toolkit: OATH Toolkit One-time password components

openssl: toolkit for general-purpose cryptography and secure communication

rhash: (RHash) Recursive Hasher

  • Additional utilities

apache2: ​​a high performance Unix-based HTTP server

bind: the ISC DNS server

dnsmasq: a lightweight DNS, DHCP, RA, TFTP, and PXE server

mariadb: a fast SQL database server

mysql: dummy package for mysql migration

postgresql14: a sophisticated object-relational DBMS, version 14   

Working with packages

Alpaquita Linux utilizes the APK package manager from the apk-tools package with a few differences from the upstream version:

  • We provide support for alternative packages and cleaner DB handling;
  • Alpaquita package repositories include three latest versions of packages, so you can install the latest version or downgrade a package if necessary;
  • The results of apk search are listed alphabetically for convenience. In addition, it is possible to search for reverse dependencies, i.e., packages that depend on the selected library.

In addition, Alpaquita Linux is distributed under EULA (End-user license agreement), meaning that all packages are verified against clean licenses, so there’s no risk of license violation.

Most commands are similar to those used in APT and YUM/DNF; the differences are summarized in the table below. 

 

APK

APT

YUM/DNF

Install a package

apk add <package name>

apt install <package name>

yum install <package name>

Remove a package

apk del <package name>

apt remove <package name>

yum remove <package name>

Upgrade a package

apk add -u <package name>

apt install <package name>

yum upgrade <package name>

Downgrade a package

apk add -d <package name>

yum downgrade <package name>

Install a specified version

apk add <package name>=$version

apt install <package name>=$version

yum install <package name>-$version

First thing first, we recommend updating a package index before performing any of the actions listed in the sections below. Run

sudo apk update

Search for packages

The basic apk search command searches through files in repositories and lists all available packages alphabetically. If you want to use wildcards, add the -v flag, for instance:

apk search -v 'liberica11-lite*'

The -r flag enables you to search for reversed dependencies, for example:

apk search -r <package name>

To retrieve all information about a package, run

apk info -a <package name> 

Install and remove packages

To install the latest version of a package, run

sudo apk add <package name>

The command accepts several package names separated with a comma. You can also install a specific package version with

sudo apk add <package name>=$version

To remove a package, use the following command:

sudo apk del <package name>

Like sudo apk add, this command accepts several packages.

Upgrade or downgrade packages

To upgrade a package to the latest version, run

apk add -u <package name>

If you don’t specify the package name, all packages will be upgraded.

To downgrade a package, use

sudo apk add -d <package name>

Find out more about working with APK in a dedicated guide.

Explore Alpaquita Linux on Docker Hub

Apart from an extensive selection of packages, we provide numerous ready images:

  • Alpaquita base image;
  • Liberica runtime container with JDK/JRE;
  • Liberica Native Image Kit container for native image generation and deployment;
  • Alpaquita for C/C++;
  • Alpaquita for Python. 

We prepared an interactive walkthrough of our Docker hub repositories to avoid getting lost in the labyrinth of image tags. Alternatively, head to Docker Hub, choose an image, and test it with your application.

Explore BellSoft’s Docker Hub profile

All images with Alpaquita Stream are free to use. However, if your company needs enterprise support, we offer Alpaquita LTS with 24/7 technical service, emergency patches, and regular updates both for Java and Linux.

Have you already tested Alpaquita Linux and need a comprehensive technical overview to present to the management? Download the white paper with a thorough description of Alpaquits’s features and performance numbers!

Get Alpaquita white paper

Subcribe to our newsletter

figure

Read the industry news, receive solutions to your problems, and find the ways to save money.

Further reading