Yum-utils, a collection of utilities that integrate with yum to extend its native features in several ways, thus making it more powerful and easier to use.


Installing yum-utils in RHEL/CentOS


Yum-utils is included in the base repo (which is enabled by default) so installing it in any Fedora-based distribution is as easy as doing:

# yum update && yum install yum-utils


All of the utilities provided by yum-utils are installed automatically with the main package, which we will describe in the next section.


Explore Utilities Provided by yum-utils Package


The tools provided by yum-utils are listed in its man page:

# man yum-utils


Here are 10 of those yum utilities we thought you would be interested in:


1. Debug a Package


debuginfo-install <package name> installs the debuginfo packages (and their dependencies) required to debug  <package name> in case of a crash or while developing applications that use a certain package.


In order to debug a package (or any other executable), we will also need to install gdb (the GNU debugger) and use it to start a program in debugging mode.


For example:

# gdb $(which postfix)


2. Find Repository of Installed Packages


The following command shows which repository the currently installed packages <package 1> <package 2> … <package n> were installed from:

# find-repos-of-install httpd postfix dovecot


3. Remove Duplicate or Orphaned Packages


package-cleanup manages package-cleanup, duplicates, orphaned packages (programs installed from a source other than the currently configured repositories) and other dependency inconsistencies, including removing old kernels as shown in the following example:

# package-cleanup --orphans
# package-cleanup --oldkernels


4. Find Out Package Dependency List


repo-graph returns a full package dependency list in dot format for all of the packages that are available from the configured repositories. Alternatively, repo-graph can return the same information by repository if used with the --repoid=<repo> option.


For example, let’s view the dependencies for each package in the updates repository:

# repo-graph --repoid=updates | less


In the above command, we are sending the output of repo-graph to less for easier visualization, but you can alternatively redirect it to a local file for later inspection:


# repo-graph --repoid=updates > updates-dependencies.txt

In either case, we can see that the iputils package depends on systemd and openssl-libs.


5. Check List of Unresolved Dependencies


repoclosure reads the metadata of configured repositories, checks dependencies of packages included in them and displays list of unresolved dependencies for each package:

# repoclosure


6. How to Check Newest or Oldest Packages in a Directory


repomanage queries a directory with rpm packages and returns a list of newest or oldest packages in a directory. This tool can come in handy if you have a directory where you store several .rpm packages of different programs.


When executed without arguments, repomanage returns the newest packages. If run with the --old flag, it will return the oldest packages:

# ls -l
# cd rpms
# ls -l rpms
# repomanage rpms


7. Query Yum Repositories to Get Information about Package


repoquery queries yum repositories and gets additional information on packages, whether they are installed or not (dependencies, files included in the package, and more).


For example, htop (Linux Process Monitoring ) is not currently installed on this system, as you can see below:


# which htop
# rpm -qa | grep htop


Now suppose we want to list the dependencies of htop, along with the files that are included in a default installation. To do so, execute the following two commands, respectively:


# repoquery --requires htop
# repoquery --list htop


8. Dump All Installed RPM Packages into Zip File


yum-debug-dump allows you to dump a complete list of all packages you have installed, all packages available in any repository, important configuration and system information into a zipped file.


This can come in handy in case you want to debug a problem that has occurred. For our convenience, yum-debug-dump names the file as yum_debug_dump-<hostname>-<time>.txt.gz, which allows us to track the changes over time.

# yum-debug-dump


As with any compressed text file, we can view its contents using zless command:

# zless yum_debug_dump-mail.linuxnewz.com-2015-11-27_08:34:01.txt.gz


Should you need to restore the configuration information provided by yum-debug-dump, you can use yum-debug-restore to do so:

# yum-debug-restore yum_debug_dump-mail.linuxnewz.com-2015-11-27_08:34:01.txt.


9. Downloading Source RPMs from Yum Repositories


yumdownloader downloads source RPM files from repositories, including their dependencies. Useful to create a network repository to be accessed from other machines with restricted Internet access.


Yumdownloader allows you to not only download the binary RPMs but also the source ones (if used with the  --source option).


For example, let’s create a directory named htop-files where we will store the RPM(s) needed to install the program using rpm. To do so, we need to use the --resolve switch along with yumdownloader:

# mkdir htop-files
# cd htop-files
# yumdownloader --resolve htop
# rpm -Uvh 


10. Synchronize a Remote Yum Repository to a Local Directory


reposync is closely related to yumdownloader (in fact, they support almost the same options) but offers a considerable advantage. Instead of downloading binary or source RPM files, it synchronizes a remote repository to a local directory.


Let’s sync the well-known EPEL repository to a subdirectory called epel-local inside the current working directory:

# man reposync
# mkdir epel-local
# reposync --repoid=epel --download_path=epel-local


Once the synchronization has completed, let’s check the amount of disk space used by our newly-created mirror of the EPEL repository using du command:

# du -sch epel-local/*


11. Fix Unfinished or Aborted Yum Transactions


yum-complete-transaction is a part of yum-utils program which catch unfinished or aborted yum transactions on a system and try to complete them.


For example, when we update the Linux servers via yum package manager sometimes it throws a warning message which read as follows:


There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.


To fix such warning messages and resolve such issue, yum-complete-transaction command comes into the picture to complete the unfinished transactions, it finds those incomplete or aborted yum transactions in transaction-all* and transaction-done* files which can be found in /var/lib/yum directory.


Run yum-complete-transaction command to finish incomplete yum transactions:

# yum-complete-transaction --cleanup-only


Now yum commands will run without the incomplete transaction warnings.

# yum update


Was this answer helpful? 1 Users Found This Useful (1 Votes)