RPM Package Management

From wiki
Revision as of 11:41, 5 May 2022 by Johayek (talk | contribs)
Jump to navigation Jump to search

DNF

DNF is a rewrite of yum, DNF replaced YUM as the default package manager in Fedora 22.

yum

YUM allows for automatic updates and package and dependency management on RPM-based distributions. YUM works with software repositories (collections of packages), which can be accessed locally or over a network connection.

  • which package provides this file?
$ yum provides /path/to/your/file
  • which repo provides this package?
$ yum list available | fgrep PACKAGE
  • which repo is this this package installed from?
$ yum list installed | fgrep PACKAGE
$ yum remove PACKAGE
  • not only remove …, but also remove dependencies!
$ yum -y autoremove PACKAGE

yum-utils

$ yum install yum-utils

repoquery

--plugins: enable YUM plugin support.

  • list the contents of PACKAGE -- PACKAGE is possibly not (yet) installed, i.e. only lives in the repo:
$ repoquery --query --list --plugins PACKAGE

rpm

  • which package provides FILE?
$ rpm --query --file FILE
  • list the contents of PACKAGE:
$ rpm --query PACKAGE
$ rpm --query --queryformat "[%{=NAME}-%{=VERSION}-%{=RELEASE}:\t%-50{FILENAMES} %10{FILESIZES}\n]" PACKAGE
  • how to list package updates:
$ rpm --query --all --queryformat '%{INSTALLTIME} %-40{NAME} %{INSTALLTIME:date}\n' | sort -n | cut -d' ' -f2-

the "sort" command sorts the query output numerically by its very 1st column (the INSTALLTIME). the "cut" command removes that very 1st column. the output still includes the INSTALLTIME at the end of the line (in a more readable format, not intended to be sorted by).

repositories