dropdown menu

RPM - DNF

DNF (Dandified YUM)

DNF is the next version of  YUM (YUM is a package manager for RPMs). 
dnf roughly maintains CLI compatibility with yum and existing AIX Toolbox repositories created for yum are working good with dnf too, so no changes needed in repository side.

yum is based on python2 and python2 is out of support, so there was a need to move to python3, dnf  works with python3.

AIX Toolbox News: https://www.ibm.com/support/pages/node/6833478
DNF install: https://community.ibm.com/community/user/power/blogs/sangamesh-mallayya1/2021/05/28/dnf-is-now-available-on-aix-toolbox
DNF config details: https://developer.ibm.com/tutorials/awb-configuring-dnf-create-local-repos-ibm-aix/
Just in case if all rpm need to be removed: https://community.ibm.com/community/user/power/blogs/jan-harris1/2022/05/25/destroyrpms

On AIX dnf uses the repository conf file: /opt/freeware/etc/dnf/dnf.conf
[AIX_Toolbox]
name=AIX generic repository
baseurl= file:///export/rpms/AIX_Toolbox/
enabled=1

...
...

[AIX_Toolbox_73]
name=AIX 7.3 specific repository
baseurl= file:///export/rpms/AIX_Toolbox_73/
enabled=0

[CUST_RPMS]
name=Customer specific RPMs
baseurl= file:///export/rpms/CUST_RPMS
enabled=1


By default dnf will cache data to the /var/cache/dnf directory, such as package and repository data. This speeds up dnf so that it doesn’t have to keep querying this information from the Internet.
There are times when you may want to delete this cached data, such as if a repository has updated packages but your system has incorrect or stale cached data which may cause various problems when attempting to install a package: dnf clean all


The dnf cache will be automatically built up over time when you perform various dnf queries such as installing or updating packages, however we have the option to manually make the cache so that future actions will be quicker with the ‘makecache’ argument: dnf makecache

-------------------------------------

DNF options

Special options can be used with the dnf commands, for example: dnf install httpd --verbose

some dnf options:
--cacheonly      <--run from system cache, don’t update the cache and use it even it is expired. (DNF uses a separate cache for each user, the root user cache is the system cache. )
--disablerepo / enablerepo=<repoid>   <--temporarily disable/enable  active repositories for the purpose of the current dnf command.
--downloadonly                   <--download without performing any rpm transaction (install/upgrade/erase).
--downloaddir / destdir=<path>   <-- download packages to this dir (it has to be used with --downloadonly, the download, modulesync, reposync or system-upgrade commands (dnf-plugins-core).
--exclude=<package-file-spec>    <--exclude packages specified by <package-file-spec> from the operation.
--nogpgcheck                     <--skip checking GPG signatures on packages (if RPM policy allows).
--refresh                        <--set metadata (cache) as expired before running the command.
--repo / repoid=<repoid>         <--enable just specific repositories by an id or a glob.
--showduplicates                 <--show duplicate packages in repositories. Applicable for the list and search commands.
--verbose                        <--Verbose operation, show debug messages.
--version                        <--Show DNF version and exit.  (-v can be used aswell)
--assumeyes                      <--Automatically answer yes for all questions. (-y can be used as well)
--setopt=<parameter=value>       <--override the configuration file (for example: --setopt=sslverify=false)

-------------------------------------

DNF Plugins

The core DNF functionality can be extended with plugins. 
There are officially supported Core DNF plugins and also third-party Extras DNF Plugins.

dnf-plugins-core  can be installed on Linux to have Core DNF plugins: download, repomange, reposync...
dnf download ...       <--download binary (rpm) or source packages without installing it (!!! this is missing on AIX)
dnf repomanage ...     <--repomanage prints newest or older packages in a repository specified by <path> for easy piping to xargs or similar programs.
dnf repodiff ...       <--list of differences between two or more repositories
dnf reposync ...       <--makes local copies of remote repos (sync a remote repo to a local dir, packages that are already present locally are not downloaded again)


On AIX most of plugins are in dnf-utils. dnf-plugins-core on AIX is not a real rpm, it creates dependencies for example to this: python3.9-dnf-plugins-core-4.0.16-32_52.aix7.2.ppc.rpm, which contains python files of repodiff, reposync...


# dnf repoquery -l dnf-utils
...
/opt/freeware/bin/repodiff
/opt/freeware/bin/repomanage
/opt/freeware/bin/repoquery
/opt/freeware/bin/reposync
/opt/freeware/libexec/dnf-utils


!!! createrepo command comes from the separate createrepo_c package not as dnf plugin (it is not in dnf-utils)


======================================================

/opt/freeware/etc/dnf/dnf.conf                    <--main dnf configuration file (dnf commands by default use this file)

dnf repolist                                      <--list repositories
dnf search bash*                                  <--list packgages starting with bash... in the repo
dnf list bash*                                    <--list packgages starting with bash... which are installed + in the repo

dnf list installed                                <--list installed packages (a package is installed if it is in RPMDB, same as rpm -qa)
dnf list installed x*                             <--list installed packages starting with "x"

dnf list available                                <--list pacckages that are available to install (a package is available if it is not installed but present in a repo)
dnf list upgrades                                 <--list updates available for installed packages ("update", "updates" are depreciated)
dnf check-upgrade                                 <--same as above

Officially "installed", "available"... actions should have 2 dash (--) in front, like --installed, --available...
A dnf list command should look like: dnf [options] list --installed (e.g.: dnf --config=/tmp/dnf.conf.remote list --upgrades)
By default "dnf list" uses the "--all" option, which list all packages present in rpmdb, in a repo or both (installed + available = full repo content)

dnf install <package>                             <--install a package + dependencies (more packages: dnf install package1 package2 …)
dnf install <package> -y                          <--install a package without asking anything before install (assumes yes)
dnf install <package> -v                          <--install with verbose output
dnf install <package_name>-<version_info>         <--install a specific version (like: dnf install gcc-6.3.0-1)
dnf localinstall </path/to/package>               <--install a package from local path instead of a repository
dnf install httpd-1.4.rpm                         <--install a local rpm file with dnf
dnf reinstall httpd                               <--if a package has a problem it can be reinstalled

dnf remove <package>                              <--remove a package

dnf upgrade                                       <--upgrade all possible installed packages ("update" is depreciated)
dnf upgrade <package>                             <--upgrde a package (with its dependencies if needed) 
dnf upgrade -x httpd                              <--exclude httpd packeage from the update
dnf downgrade <package>                           <--downgrade a package

dnf history                                       <--lists history of yum actions (same as yum history list all)
dnf history info <transaction_ID>                 <--gives details about the specified history transaction id
dnf history undo <transaction_ID>                 <--roll backs the given tranaction id

dnf info bash                                     <--show infow about specific package
dnf provides /opt/freeware/bin/bash               <--list the package which provides that file (command)  ("dnf repoquery --file..." or "rpm -qf ..." show some info as well)
dnf repoquery -l bash                             <--list files in a package (--list or "rpm -ql bash" is the same if it is already installed)

dnf makecache                                     <--download and caches metadata for repositories
dnf makecache --refresh
dnf clean all                                     <--cleans up cache


dnf --config /tmp/dnf.conf check-upgrade          <--list for available updates for our installed packages  (it will not do the update)
dnf --disablerepo="*" --enablerepo="epel" list available       <--lists packages only in a specific repo (use output of "yum repolist" )
dnf --disablerepo=* --enablerepo=LIVE* list Centrify*          <--lists installed and available packages from LIVE* repos


Plugins:

createrepo --checksum sha --update /etc/repo      <--update repo after a new package is copied there (dnf createrepo ... should work as well)
createrepo --quiet --update --skip-stat /export/rpms/AIX_Toolbox_72
--quiet                                           <--run quietly
--update                                          <--if metadata exists and rpm is unchanged (based on file size and mtime) then reuse the existing metadata rather then recalculating it
--skip-stat                                       <--skip stat() function call on files using --update (assumes if the file name is the same the the file is still the same)


dnf download httpd                                <--!!NOT on AIX!!! download the rpm without installing it (download plugin can be installed: dnf install dnf-plugins-core)
dnf repomanage --old /export/rpms/AIX_Toolbox     <--list older packages
dnf repomanage --new /export/rpms/AIX_Toolbox     <--list newest packages

download (sync) a repo locally from a conf file (this conf file contains the ibm repo address):
dnf reposync --newest-only --downloadcomps --download-metadata --download-path=/export/rpms --config=/tmp/dnf.ibm.conf --repoid=AIX_Toolbox_72 --arch=ppc

same as above just --urls will not download anything it will just show the urls for the packages:
dnf reposync --newest-only --downloadcomps --download-metadata --download-path=/home/tmp/dnf --config=/tmp/dnf.ibm.conf --repoid=AIX_Toolbox --arch=ppc --urls

dnf reposync \                    
--newest-only \                   <--download only newest packages per repo
--downloadcomps \                 <--download and uncompress comps.xml. Consider using --download-metadata which downloads all available repo metadata
--download-metadata \             <--download repository metadata. Downloaded copy is instantly usable as a repository, no need to run createrepo_c on it
--download-path=/export/rpms/ \   <--path under which the downloaded repositories are stored
--config=/opt/freeware/etc/dnf/dnf.conf.remote \              <--config file to use
--repoid=AIX_Toolbox_72           <--which repo to synchronize
--arch=ppc                        <--download packages of given architectures


repodiff
dnf repodiff --repofrompath=o,file:///export/rpms/AIX_Toolbox/ --repofrompath=n,https://public.dhe.ibm.com/aix/aixtoolbox/RPMS/ppc/ --repo-old=o --repo-new=n

repodiff without ssl verification:
dnf repodiff --setopt=sslverify=false --repofrompath=o,file:///export/rpms/AIX_Toolbox/ --repofrompath=n,https://public.dhe.ibm.com/aix/aixtoolbox/RPMS/ppc/ --repo-old=o --repo-new=n

No comments: