RPM Package Management: Difference between revisions

From wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
== intro ==
* rpm – for handling the packages themselves
* yum – the traditional level on top of rpm commands, dealing with dependencies and repositories
* DNF – the modern level on top of rpm commands, dealing with dependencies and repositories
== DNF ==
== DNF ==
DNF is a rewrite of yum, DNF replaced YUM as the default package manager in Fedora 22.
DNF is a rewrite of yum, DNF replaced YUM as the default package manager in Fedora 22.


* https://en.wikipedia.org/wiki/DNF_(software)
* https://en.wikipedia.org/wiki/DNF_(software)
* https://www.man7.org/linux/man-pages/man8/dnf.8.html
* https://opensource.com/article/18/8/guide-yum-dnf
* https://opensource.com/article/18/8/guide-yum-dnf
<pre>
$ yum module list MODULENAME
$ dnf install @MODULENAME:STREAM
</pre>


== yum ==
== yum ==
Line 15: Line 26:
YUM allows for automatic updates and package and dependency management on RPM-based distributions.
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.
YUM works with software repositories (collections of packages), which can be accessed locally or over a network connection.
* ...
<pre>
$ yum makecache
</pre>


* which package provides this file?
* which package provides this file?
Line 38: Line 54:
* not only remove …, but also remove dependencies!
* not only remove …, but also remove dependencies!
<pre>
<pre>
$ yum autoremove PACKAGE
$ yum -y autoremove PACKAGE
</pre>
 
* you can display the list of packages available for installation in a specific repo REPO:
<pre>
$ yum repo-pkgs REPO list
</pre>
</pre>


Line 68: Line 89:
$ rpm --query --queryformat "[%{=NAME}-%{=VERSION}-%{=RELEASE}:\t%-50{FILENAMES} %10{FILESIZES}\n]" PACKAGE
$ rpm --query --queryformat "[%{=NAME}-%{=VERSION}-%{=RELEASE}:\t%-50{FILENAMES} %10{FILESIZES}\n]" PACKAGE
</pre>
</pre>
* how to list package updates:
<pre>
$ rpm --query --all --queryformat '%{INSTALLTIME} %-40{NAME} %{INSTALLTIME:date}\n' | sort -n | cut -d' ' -f2-
</pre>
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 ==
* /etc/yum.repos.d/
* http://woshub.com/install-configure-repos-centos-rhel/ – nice instructions

Latest revision as of 13:36, 26 February 2024

intro[edit]

  • rpm – for handling the packages themselves
  • yum – the traditional level on top of rpm commands, dealing with dependencies and repositories
  • DNF – the modern level on top of rpm commands, dealing with dependencies and repositories

DNF[edit]

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

$ yum module list MODULENAME
$ dnf install @MODULENAME:STREAM

yum[edit]

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.

  • ...
$ yum makecache
  • 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
  • you can display the list of packages available for installation in a specific repo REPO:
$ yum repo-pkgs REPO list

yum-utils[edit]

$ yum install yum-utils

repoquery[edit]

--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[edit]

  • 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[edit]