How to use 10 yum utils to boost its performance

To use 10 yum utils to boost its performance

yum utils is a collection of utilities, which integrates with yum to extend its native features in different ways, and making it more powerful. It is easier to use.

To install yum utils

yum update & & yum install yum-utils

To Debug a Package

This command helps to install the debug info of some packages.

Syntax
debuginfo-install

This command helps to install the debug info of some packages.
Here, I have taken example as Squid,

Example

[root@linuxhelp ~]# gdb $(which squid)
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-83.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later < http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type " show copying" 
and " show warranty"  for details.
This GDB was configured as " x86_64-redhat-linux-gnu" .
For bug reporting instructions, please see:
< http://www.gnu.org/software/gdb/bugs/> ...
Reading symbols from /usr/sbin/squid...Reading symbols from /usr/lib/debug/usr/sbin/squid.debug...done.
done.
(gdb) run
Starting program: /usr/sbin/squid 
[Thread debugging using libthread_db enabled]
[root@linuxhelp ~]# service squid status
Squid (pid 13852)is running&hellip 


So, It started to run using gdb debugger.

To find repository of installed packages

It helps in finding the repos, where that package is stored respectively.

Syntax
find-repos-of-install

Example

[root@linuxhelp ~]# find-repos-of-install httpd squid
Loaded plugins: auto-update-debuginfo, fastestmirror, refresh-packagekit
httpd-2.2.15-47.el6.centos.3.x86_64 from repo updates
7:squid-3.1.23-9.el6.x86_64 from repo base


Here, you can see that httpd package is stored in Updates repo , whereas Squid is located in Base repo.

To remove duplicate or orphaned packages

Syntax
package-cleanup --orphans
package-cleanup --oldkernels

Example

[root@linuxhelp ~]# package-cleanup --orphans
Loaded plugins: auto-update-debuginfo, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: ftp.iitm.ac.in
 * extras: mirror.digistar.vn
 * updates: ftp.iitm.ac.in


Since there is no orphan package it jus simply displays the repo list alone.

[root@linuxhelp ~]# package-cleanup --oldkernels
Loaded plugins: fastestmirror, kabi, presto, refresh-packagekit, versionlock
Loading support for CentOS kernel ABI
No old kernels to remove

This command will just clean only the old kernels but it wont disturb the latest or present kernel.

To sort out package dependency list

Example

[root@linuxhelp]# repo-graph --repoid=updates | less
digraph packages { 
size=" 20.69,25.52"  
ratio=" fill"  
rankdir=" TB"  
orientation=port 
node[data-style=" filled" ] 
“ iputils”  [color=” 0.523245654 0.235446745 1.0” ] 
“ iputils”  ->  {
“ squid” 
“ puppet” 
} [color=" 0.552173913043 0.652173913043 1.0" ] 
" libreoffice-librelogo"  [color=" 0.552173913043 0.652173913043 1.0" ] 
" libreoffice-librelogo"  ->  {
" libreoffice-writer" 
" libreoffice-pyuno" 
} [color=" 0.552173913043 0.652173913043 1.0" ] 
" perl-parent"  [color=" 0.526086956522 0.626086956522 1.0" ] 
" perl-parent"  ->  {
" perl" 
&hellip 
&hellip 
&hellip 

So, it will list the complete details of the available package details in the respective repo.

To redirect it to a local file

[root@linuxhelp~]# repo-graph --repoid=updates >  updates-repo-file.txt
[root@linuxhelp~]#cat updates-repo-file.txt
digraph packages { 
size=" 20.69,25.52"  
ratio=" fill"  
rankdir=" TB"  
orientation=port 
node[data-style=" filled" ] 
“ iputils”  [color=” 0.523245654 0.235446745 1.0” ] 
“ iputils”  ->  {
“ squid” 
“ puppet” 
}} [color=" 0.552173913043 0.652173913043 1.0" ] 
" libreoffice-librelogo"  [color=" 0.552173913043 0.652173913043 1.0" ] 
" libreoffice-librelogo"  ->  {
" libreoffice-writer" 
" libreoffice-pyuno" 
} [color=" 0.552173913043 0.652173913043 1.0" ] 
" perl-parent"  [color=" 0.526086956522 0.626086956522 1.0" ] 
" perl-parent"  ->  {
" perl" 
&hellip 
&hellip 
&hellip 

To check Unresolved Dependencies

If some packages is not installed properly with their dependencies, then it will return the name of the package with the respective repo it located.

Example

[root@linuxhelp ~]# repoclosure
Reading in repository metadata - please wait....
Checking Dependencies
Repos looked at: 5
   base
   extras
   puppetlabs-deps
   puppetlabs-products
   updates
Num Packages in Repos: 8511
package: freight-0.3.5-7.el6.noarch from puppetlabs-products
  unresolved deps: 
     dpkg

Here, it have checked the available repos and displaying the dpkg package as it is not resolved with dependencies.

To get info about package using Query Yum Repositories

This command helps in getting the version as well as the bit-rate. If you run only rpm &ndash qa then displays the entire packages list.

Example

[root@linuxhelp ~]# rpm -qa | grep squid
squid-3.1.23-9.el6.x86_64

To list the dependencies of squid

Example

[root@linuxhelp ~]# repoquery --requires squid
/bin/bash
/bin/sh
/sbin/chkconfig
/sbin/service
/usr/bin/perl
bash > = 2.0
libc.so.6(GLIBC_2.7)(64bit)
libcap.so.2()(64bit)
&hellip 
&hellip 
&hellip 
libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
libxml2.so.2()(64bit)

To dump installed RPM packages into zip file

This command will normally create a backup of installed packages and save it as a .gz (gunzip) file.

Example

[root@linuxhelp~]# yum-debug-dump
[root@linuxhelp~]# ls -l
-rw-r--r--  1 root root 64648 Mar 13 00:51 yum_debug_dump-linuxhelp.1-2016-03-13_00:51:37.txt.gz

To view the contents of the gzip file we can use zless command

Example

[root@linuxhelp~]# zless yum_debug_dump-linuxhelp.1-2016-03-13_00:51:37.txt.gz
yum-debug-dump version 1
%%%%SYSTEM INFO
  uname: 2.6.32-573.18.1.el6.x86_64, x86_64
  rpm ver: RPM version 4.8.0
  python ver: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
%%%%YUM INFO
  arch: ia32e
  basearch: x86_64
  releasever: 6
  yum ver: 3.2.29
  enabled plugins: refresh-packagekit,fastestmirror,auto-update-debuginfo
  global excludes: 
%%%%RPMDB PROBLEMS
%%%%RPMDB
  0:ConsoleKit-0.4.1-3.el6.x86_64
  0:ConsoleKit-libs-0.4.1-3.el6.x86_64
 &hellip 
&hellip 

To restore the configuration information

Example

[root@linuxhelp~]# yum-debug-restore yum_debug_dump-linuxhelp.1-2016-03-13_00:51:37.txt.gzIt will just restores the information about installed packages contained within.

To download source RPM from Yum

Instead of installing a package directly from yum we cam do it through rpm. So at first it will download respective rpm file for the given package and then we can able to install it normally.

Example

[root@linuxhelp~]# mkdir squid-file
[root@linuxhelp~]# cd squid-file
[root@linuxhelp~]# yumdownloader --resolve squid
[root@linuxhelp~]# rpm &ndash Uvh   squid-3.1.23-9.el6.x86_64.rpm
Preparing...                ########################################### [100%]
&hellip 
&hellip 
Squid-3.1.23-9.el6.x86_64 is installed.
Complete

To Synchronize a remote Yum Repository to Local Host

Reposync command helps to synchronize the packages in the available repo to the current directory. Here I have mentioned epel repo. So it will sync the packages in epel repo to the current working directory (home).


Example

[root@linuxhelp~]# mkdir epel-local
[root@linuxhelp~]# reposync --repoid=epel --download_path=epel-local
[root@linuxhelp epel-local]# ls -l
drwxr-xr-x 2 root root 4096 Mar 13 13:05 epel

To check the amount of disk space consumed

Example

[root@linuxhelp~]# du -sh epel-local
3.7G   epel/

To finish incomplete yum transactions

yum-complete-transaction --cleanup-only

It will start to complete the pending tum transaction where from it is left over.

Tag : yum utils
FAQ
Q
How to synchronize a Remote Yum repository to a Local Directory?
A
You can use the following syntax to synchronize a Remote Yum repository to a Local Directory. For syntax: "reposync --repoid=REPOID --download_path=/dest/path".
Q
How to take a dump all installed RPM packages into Zip File?
A
Use the following command to take a dump all installed RPM packages into Zip File. For syntax: "yum-debug-dump".
Q
How to check the list of unresolved dependencies?
A
Use the following command to check the list of unresolved dependencies. For syntax:"repoclosure"
Q
How to find out package dependency List for certain repo?
A
You can see the following syntax to find out package dependency List for certain repo. For syntax: "repo-graph --repoid=updates | less".
Q
How to remove duplicate or orphaned packages in Linux?
A
You can execute the following command to remove duplicate or orphaned packages in Linux. For syntax: "package-cleanup --orphans"
"package-cleanup --oldkernels"