\begin{exe} {Using RPM}

   Here we will just do a number of simple operations for
   querying and verifying \textbf{rpm} packages.

   This lab will work
   equally well on \textbf{Red Hat} and \textbf{SUSE}-based systems.

   \begin{enumerate}
      \item
      Find out what package the file
      \filelink{/etc/logrotate.conf} belongs to.
      \item List information about the package including all the files
      it contains.
      \item Verify the package installation.
      \item Try to remove the package.
   \end{enumerate}
   \begin{sol}

      \begin{enumerate}
         \item
         \begin{cmd}
$ rpm -qf /etc/logrotate.conf
         \end{cmd}
         \begin{response}
logrotate-3.14.0-3.el8.x86_64
         \end{response}
         \item
         \begin{cmd}
$ rpm -qil logrotate
         \end{cmd}
         \begin{response}
...
         \end{response}
         Note a fancier form that combines these two steps would be:
         \begin{cmd}
$ rpm -qil $(rpm -qf /etc/logrotate.conf)
         \end{cmd}
         \item
         \begin{cmd}
$ rpm -V logrotate
         \end{cmd}
         \begin{response}
..?......    /etc/cron.daily/logrotate
S.5....T.  c /etc/logrotate.conf
         \end{response}
         \item
         \begin{redhatbox}
            On \textbf{RHEL 8}:
            \begin{cmd}
$ sudo rpm -e logrotate
            \end{cmd}
            \begin{response}
error: Failed dependencies:
	logrotate is needed by (installed) vsftpd-3.0.3-28.el8.x86_64
	logrotate >= 3.5.2 is needed by (installed) rsyslog-8.37.0-13.el8.x86_64
            \end{response}
         \end{redhatbox}
         \begin{opensusebox}
            On \textbf{openSUSE-Leap 15.1}:
            \begin{cmd}
$ sudo  rpm -e logrotate
            \end{cmd}
            \begin{response}
error: Failed dependencies:
	logrotate is needed by (installed) xdm-1.1.11-lp151.13.2.x86_64
	logrotate is needed by (installed) wpa_supplicant-2.6-lp151.4.4.x86_64
	logrotate is needed by (installed) chrony-3.2-lp151.8.6.x86_64
	logrotate is needed by (installed) net-snmp-5.7.3-lp151.7.5.x86_64
	logrotate is needed by (installed) syslog-service-2.0-lp151.3.3.noarch
	logrotate is needed by (installed) vsftpd-3.0.3-lp151.6.3.x86_64
	logrotate is needed by (installed) libvirt-daemon-5.1.0-lp151.7.6.1.x86_64
	logrotate is needed by (installed) iscsiuio-0.7.8.2-lp151.13.6.1.x86_64
	logrotate is needed by (installed) mcelog-1.60-lp151.2.3.1.x86_64
            \end{response}
         \end{opensusebox}
         Note that the exact package dependency tree
         depends on both the distribution and choice of
         installed software.
      \end{enumerate}
   \end{sol}
\end{exe}

