Table of Content

This is a four-parts article. There are few sections here.

Part One
  • Preface: Test Bed
  • Getting Started With Docker
  • Package Management: RPM Frontend, Get Help, DNF Shell
  • Updating System: OS Release, Repository List, System Upgrade, Extra Commands
  • Package IRSIF: Install, Removal, Query Search, Show Info, Install Feature, List File
  • What's Next
Part Two
  • Dependency: Help, Dependency, Reverse Dependency, Test, Tree
  • Group: Group List, Group Info, Group Install, Beyond Group
  • Repositories: repolist, repoinfo, repo-pkgs, --enablerepo, Mirror
  • What's Next
Part Three
  • Plugin: List, Install, Help, Config Manager Example
  • History: The Log File, DNF History
  • Hold Package: Example, Add Lock, Remove Lock
  • Clean Up
  • Build from Source
  • Miscellanous: Downgrade, dist-sync
  • What's Next
Part Four
  • Build from Source: Requirement, Example, Extract, Dependencies, Build, Install
  • Inspect Package: rpmlint, rpm -Qpl, rpmls, rpm2cpio
  • Conclusion

Preface

Goal: Examine Package Manager, Focus on Command Line Interface

DNF comes, after RPM, Zypp, YUM, and URPMI. Fedora container in Docker allow people to learn DNF more easily. DNF is a Package Manager introduced by Fedora.

We need Rawhide rolling release with more often update, so that we have a chance to play more with package. No need to wait for another six month cycle.

Test Bed

  1. Container: Docker

  2. Operating System: Artix (OpenRC )

  3. Window Manager: Herbstluftwm

Since we are going to use docker again, you can read a common overview here.

Of course you can use virtualization, the issue is distraction. We need to avoid tendency to focus on GUI tools. At the same time, limiting the scope to CLI tools. Most of the time, CLI tools is considered lower level than the GUI one.


Getting Started With Docker

As usual, first, we do attach docker process.

$ docker pull fedora:rawhide

Docker Pull Fedora Rawhide

$ docker image list 

  --format 'table {{.Repository}}\t{{.Size}}'

REPOSITORY              SIZE
opensuse/amd64          101MB
dock0/arch              870MB
gentoo/stage3-amd64     873MB
debian                  100MB
fedora                  232MB
$ docker run -it fedora:rawhide bash
[root@6f45f67e56ea /]# exit
$ docker ps -a 

  --format 'table {{.Image}}\t{{.Names}}\t{{.Status}}'

IMAGE                       NAMES                  STATUS
opensuse/amd64:tumbleweed   elegant_nightingale   Exited (0) 5 hours ago
debian:stretch              dazzling_neumann      Exited (0) 5 days ago
dock0/arch                  silly_leakey          Exited (1) 5 days ago
fedora:rawhide              musing_torvalds       Up 4 hours
$ docker start musing_torvalds
musing_torvalds
$ docker attach musing_torvalds
[root@5f1ee8964269 /]# 

Docker Fedora: Getting Started


Package Management

RPM Frontend

DNF (Dandified YUM): Fedora: Python

Get Help

Read the fine manual.

$ man dnf

Since we do need have man-db nor less yet. This is what we can do.

$ dnf help | more
I cannot even be 'help | less'.

DNF Shell

Most modern package manager has shell feature, that enable user to focus on the task of managing package.

$ dnf shell
Fedora - Rawhide - Developmental pa 168 kB/s |  66 MB     06:38    
Last metadata expiration check: 0:13:32 ago on Thu Aug 24 04:58:06 2017.
> clean packages
0 files removed
> clean all
9 files removed
> 

Docker Fedora: DNFShell


Updating System

First Thing First

First thing to do is updating my system as usual.

  • OS Release

  • Repository List

  • Upgrade

  • Some Extra Command

OS Release

$ cat /etc/fedora-release 
Fedora release 27 (Rawhide)

Repository List

This Fedora container size is only 232MB, but the $ dnf repolist command is, ridiculously required to download 66MB.

$ dnf repolist
Fedora - Rawhide - Developmental packages fo 115 kB/s |  66 MB     09:43    
Last metadata expiration check: 0:04:32 ago on Wed Aug 23 10:54:25 2017.
repo id  repo name                                                     status
*rawhide Fedora - Rawhide - Developmental packages for the next Fedora 61406
[root@5f1ee8964269 /]# 

Docker DNF: Repository List

  • .

System Upgrade

update is deprecated.

$ dnf update

Now update is just an alias for upgrade.

$ dnf upgrade --nogpgcheck
Last metadata expiration check: 0:16:45 ago on Wed Aug 23 10:54:25 2017.
Dependencies resolved.
====================================================================
 Package            Arch   Version                    Repository
                                                               Size
====================================================================
Upgrading:
 acl                x86_64 2.2.52-18.fc27             rawhide  78 k
 audit-libs         x86_64 2.7.7-5.fc27               rawhide 108 k
 basesystem         noarch 11-4.fc27                  rawhide 8.9 k
 bash               x86_64 4.4.12-9.fc27              rawhide 1.5 M
 bzip2-libs         x86_64 1.0.6-24.fc27              rawhide  46 k
 ca-certificates    noarch 2017.2.16-4.fc27           rawhide 452 k
 chkconfig          x86_64 1.10-3.fc27                rawhide 186 k
 coreutils          x86_64 8.27-15.fc28               rawhide 1.2 M
 coreutils-common   x86_64 8.27-15.fc28               rawhide 1.9 M
 cracklib           x86_64 2.9.6-9.fc28               rawhide  87 k

This is a long process with a lot of text, that I have to put the output into four figures.

Docker DNF: Upgrade

Docker DNF: Upgrade

Docker DNF: Upgrade

Docker DNF: Upgrade

Extra Commands

Common clean up procedures. Actual we will discuss each later. Now I just feel the need to summarized the sequence here.

$ dnf clean packages
171 files removed
$ dnf clean all
9 files removed
$ dnf repoquery --unsatisfied
Fedora - Rawhide - Developmental pa 227 kB/s |  66 MB     04:56    
Last metadata expiration check: 0:03:58 ago on Wed Aug 23 11:50:45 2017.
$ dnf repoquery --duplicated
Last metadata expiration check: 0:08:58 ago on Wed Aug 23 11:50:45 2017.
$ dnf list extras
Last metadata expiration check: 0:07:14 ago on Wed Aug 23 11:50:45 2017.
$ sudo dnf autoremove
Last metadata expiration check: 0:11:24 ago on Wed Aug 23 11:50:45 2017.
Dependencies resolved.
Nothing to do.

Docker DNF: Extra Commands


Package IRSIF

Install, Remove, Search, Info, File

Read the fine manual. Helpless or help more. We need to install man.

Package Install

I demand to read, manual pages sir!
$ dnf install man 
Last metadata expiration check: 0:58:52 ago on Wed Aug 23 11:50:45 2017.
Dependencies resolved.
====================================================================
 Package         Arch       Version               Repository   Size
====================================================================
Installing:
 man-db          x86_64     2.7.6.1-5.fc27        rawhide     881 k
Installing dependencies:
 groff-base      x86_64     1.22.3-11.fc27        rawhide     1.0 M
 less            x86_64     487-5.fc27            rawhide     159 k
 libpipeline     x86_64     1.4.2-3.fc27          rawhide      52 k
 libstdc++       x86_64     7.1.1-7.fc27.1        rawhide     461 k

Transaction Summary
====================================================================
Install  5 Packages

Total download size: 2.5 M
Installed size: 7.9 M
Is this ok [y/N]: 

Note that I accidentaly misstype man in command line, rather than man-db.

Docker DNF: Package Install

You can reinstall.

$ dnf reinstall man-db

And you can install many packages at once too.

$ dnf install man-db nano htop ncdu fish

Package Removal

$ dnf remove less
Dependencies resolved.
=============================================================================
 Package           Arch         Version                 Repository      Size
=============================================================================
Removing:
 less              x86_64       487-5.fc27              @rawhide       309 k
Removing depended packages:
 man-db            x86_64       2.7.6.1-5.fc27          @rawhide       1.9 M
Removing unused dependencies:
 groff-base        x86_64       1.22.3-11.fc27          @rawhide       3.7 M
 libpipeline       x86_64       1.4.2-3.fc27            @rawhide       106 k

Transaction Summary
=============================================================================
Remove  3 Packages

Freed space: 6.0 M
Is this ok [y/N]: 

Docker DNF: Package Remove

$ dnf search nano
Last metadata expiration check: 1:22:32 ago on Wed Aug 23 11:50:45 2017.
======================== Name Exactly Matched: nano =========================
nano.x86_64 : A small text editor
======================= Name & Summary Matched: nano ========================
protobuf-javanano.noarch : Protocol Buffer JavaNano API
nano-debugsource.x86_64 : Debug sources for package nano
============================ Name Matched: nano =============================
nodejs-nano.noarch : Minimalistic couchdb driver for Node.js
=========================== Summary Matched: nano ===========================
perl-Time-Clock.noarch : Twenty-four hour clock object with nanosecond
                       : precision
novprog.x86_64 : Tool to graph your progress in writing a NaNoWriMo style
               : novel

Docker DNF: Package Query Search

Package Show Info

$ dnf info man-db
Last metadata expiration check: 1:21:47 ago on Wed Aug 23 11:50:45 2017.
Installed Packages
Name         : man-db
Version      : 2.7.6.1
Release      : 5.fc27
Arch         : x86_64
Size         : 1.9 M
Source       : man-db-2.7.6.1-5.fc27.src.rpm
Repo         : @System
From repo    : rawhide
Summary      : Tools for searching and reading man pages
URL          : http://www.nongnu.org/man-db/
License      : GPLv2+ and GPLv3+
Description  : The man-db package includes five tools for browsing man-pages:
             : man, whatis, apropos, manpath and lexgrog. man formats and
             : displays manual pages. whatis searches the manual page names.
             : apropos searches the manual page names and descriptions.
             : manpath determines search path for manual pages. lexgrog
             : directly reads header information in manual pages.

Docker DNF: Package Show Info

Install Feature

There are DNF feature that I do not see exist in other package management. I found this in a google plus posted by “Thorsten Leemhuis”.

The first one is, DNF install package that, provides certain executable as below example.

$ dnf install /usr/bin/mpc
Last metadata expiration check: 0:09:22 ago on Sat Sep 16 15:04:13 2017.
Dependencies resolved.
====================================================================
 Package           Arch        Version           Repository    Size
====================================================================
Installing:
 mpc               x86_64      0.28-5.fc27       rawhide       52 k
Installing dependencies:
 libmpdclient      x86_64      2.13-1.fc27       rawhide       49 k

Transaction Summary
====================================================================
Install  2 Packages

Total download size: 101 k
Installed size: 210 k
Is this ok [y/N]: 

Docker DNF: Package Install Feature Executable

The second is, install Perl package that provide specific library.

$ dnf install 'perl(File::Basename)'
Last metadata expiration check: 0:37:04 ago on Sat Sep 16 15:04:13 2017.
Dependencies resolved.
====================================================================
 Package                 Arch    Version             Repository
                                                               Size
====================================================================
Installing:
 perl-interpreter        x86_64  4:5.26.0-399.fc28   rawhide  6.2 M
Installing dependencies:
 perl-Carp               noarch  1.42-394.fc27       rawhide   28 k
 ...
 perl-threads-shared     x86_64  1.57-4.fc27         rawhide   46 k

Transaction Summary
====================================================================
Install  17 Packages

Total download size: 8.6 M
Installed size: 21 M
Is this ok [y/N]: 

Docker DNF: Package Install Feature Library

Package File List

Therefore is something similar with rpm -ql.

$ dnf repoquery -l ncdu
Last metadata expiration check: 1:50:36 ago on Wed Sep 20 14:19:59 2017.
/usr/bin/ncdu
/usr/lib/.build-id
/usr/lib/.build-id/83
/usr/lib/.build-id/83/e67e014bbe91489897a5c369d4716734fc26e0
/usr/share/doc/ncdu
/usr/share/doc/ncdu/COPYING
/usr/share/doc/ncdu/ChangeLog
/usr/share/man/man1/ncdu.1.gz

Docker DNF: List File

My bad, I cannot find any reference searching files owner. Therefore I use the lower level rpm -qf instead.

$ rpm -qf /etc/man_db.conf 
man-db-2.7.6.1-5.fc27.x86_64

Docker RPM: Query File


What’s Next

These are just preliminary knowledge about DNF. Consider finish reading [ Part Two ].

Thank you for reading