\section{dnf and yum}

\begin{frame}
   {What is dnf?}

   \begin{itemize}
      \item Used as a front end to RPM
      \item Can fetch packages from remote repositories
      \begin{itemize}
         \item Can rely on multiple independent
         repositories
         \item Repository configuration files in
         \filelink{/etc/yum.repos.d/}
      \end{itemize}
      \item Can resolve dependencies
      \item Used by \textbf{RHEL}, \textbf{CentOS},
      \textbf{Fedora} and others
   \end{itemize}
   \begin{figure}[H]
      \includegraphics[width=4.75in]{IMAGES/yumrepos}
      \caption{rpm Repositories}
   \end{figure}

\end{frame}

\cprotect\note{

   \textbf{dnf} has a number of features that make it useful for
   package management. It is a front end to \textbf{RPM},
   but also has the capabilities to retrieve packages from
   one or more remote repositories.  One of its best
   features is the ability to resolve dependencies.

   The configuration files for repositories are located in
   the \filelink{/etc/yum.repos.d} directory and have a
   \texttt{.repo} extension.

   A very simple repo file might look like:
   \begin{configlst}[\texttt{Sample Repo}]
[repo-name]
    name=Description of the repository
    baseurl=http://somesystem.com/path/to/repo
    enabled=1
    gpgcheck=1
   \end{configlst}

   \textbf{dnf} caches information and databases to speed
   up performance.  To remove some or all cached
   information one can run the command:
   \begin{cmd}
$ dnf clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
   \end{cmd}

   One can toggle use of a particular repo on or off by
   changing the value of \texttt{enabled}, or using the
   \verb?--disablerepo somerepo? and
   \verb?--enablerepo somerepo? options.

   We will concentrate on the command line use of
   \textbf{dnf} and not consider the graphical interfaces
   distributions provide.

}

\section{yum}
\begin{frame}
   {yum}
   \begin{itemize}
      \item \textbf{dnf} replaced \textbf{yum} during the
      \textbf{RHEL/CentOS 7} to \textbf{8} transition.
      \item
      \textbf{Fedora} has used it even longer

      \item \textbf{dnf} is backwards compatible:
      \begin{itemize}
         \item Almost all common \textbf{yum} commands still
         work
      \end{itemize}

      \item For more documentation, see:

      \url{https://docs.fedoraproject.org/en-US/quick-docs/dnf/}

      \url{https://dnf.readthedocs.io/en/latest/}

   \end{itemize}
\end{frame}

\cprotect\note{

   If you try to run \textbf{yum} commands, some versions
   of \textbf{dnf} will alert you that these are deprecated,
   and point you to the right command.

   If you are an experienced \textbf{yum} user, you can
   gradually learn to use \textbf{dnf}
   because it accepts the subset of \textbf{yum}
   commands that take care of the majority of day to day
   tasks.

}

\section{Queries}
\begin{frame}
   {Queries}

   \begin{itemize}
      \item Can be used to search packages
      \begin{cmd}
$ dnf search
$ dnf info
$ dnf list
$ dnf grouplist
$ dnf groupinfo
      \end{cmd}
      \item Can be used to search files
      \begin{cmd}
$ dnf provides
      \end{cmd}
   \end{itemize}

\end{frame}

\cprotect\note{

   \begin{cmd}
$ dnf search keyword
   \end{cmd}
   search for package with keyword in it.

   \begin{cmd}
$ dnf info package-name
   \end{cmd}
   Display information about a package.

   \begin{cmd}
$ dnf list [installed | updates | available]
   \end{cmd}
   List packages installed, available, or updates.

   \begin{cmd}
$ dnf grouplist
   \end{cmd}
   Show information about package groups installed, available, or updates.

   \begin{cmd}
$ dnf groupinfo packagegroup
   \end{cmd}
   show information about a packagegroup.

   \begin{cmd}
$ dnf provides /path/to/file
   \end{cmd}
   Shows the owner of the package for file.  (Note the
   need to use at least one \texttt{/} in the file name,
   which can be confusing.)

}
\section{Installing/Removing/Upgrading Packages}
\begin{frame}
   {Installing/Removing/Upgrading Packages}
   \begin{itemize}
      \item Commands:
      \begin{cmd}
$ sudo dnf install
$ sudo dnf localinstall
$ sudo dnf groupinstall
$ sudo dnf remove
$ sudo dnf update
      \end{cmd}
      \begin{itemize}
         \item \texttt{.rpmsave}
         \item \texttt{.rpmnew}
      \end{itemize}
   \end{itemize}

\end{frame}

\cprotect\note{

   \begin{cmd}
$ sudo dnf install package
   \end{cmd}
   installs a package from a repository.  Also resolves
   and installs dependencies.

   \begin{cmd}
$ sudo dnf localinstall package-file
   \end{cmd}
   installs a package from a local rpm file.

   \begin{cmd}
$ sudo dnf groupinstall 'group-name'
   \end{cmd}
   installs a specific software group from a
   repository, Also resolves and installs
   dependencies for each package in the group.

   \begin{cmd}
$ sudo dnf remove package
   \end{cmd}
   removes a package from the system.

   \begin{cmd}
$ sudo dnf update [package]
   \end{cmd}
   updates a package from a repository.  If no package
   listed, updates all packages.

   During installation (or update), if a package has a
   configuration file which is updated, it will rename
   the old configuration file with a \texttt{.rpmsave}
   extension.  If the old configuration file will still
   work with the new software, it will name the new
   configuration file with a \texttt{.rpmnew} extension.
   You can search for these filename extensions to see if
   you need to do any reconciliation of the files.
}

\section {Additional dnf Commands}
\begin{frame}
   {Additional dnf Commands}

   \begin{cmd}
$ sudo dnf repolist
     
$ sudo dnf shell

$ sudo dnf shell [text-file}
     
$ sudo dnf install --downloadonly

$ sudo dnf history

$ sudo dnf clean [packages|metadata|expire-cache|rpmdb|plugins|all]
   \end{cmd}

\end{frame}

\cprotect\note{

   \begin{cmd}
$ sudo dnf list "dnf-plugin*"
   \end{cmd}
   lists additional \textbf{dnf} plugins
   \begin{cmd}
$ sudo dnf repolist
   \end{cmd}
   shows a list of enabled repositories.
   \begin{cmd}
$ sudo dnf shell
$ sudo dnf shell file.txt
   \end{cmd}
   provides an interactive shell in which to run multiple
   dnf commands. The second form executes the commands in
   \filelink{file.txt}.

   \begin{cmd}
$ sudo dnf install --downloadonly package
   \end{cmd}
   Will only download the packages for you.  It stores
   them in the \filelink{/var/cache/dnf} directory.

   \begin{cmd}
$ sudo dnf history
   \end{cmd}
   View the history of \textbf{dnf} commands on the
   system, and with the correction options, even undo or
   redo previous commands.

   \begin{cmd}
$ sudo dnf clean [packages|metadata|expire-cache|rpmdb|plugins|all]
   \end{cmd}
   Clean up locally stored files and metadata under
   \filelink{/var/cache/dnf}.  This saves space and does
   housecleaning of obsolete data.

}


