YUM

Commands

  • Search package names and descriptions: yum search httpd
  • List installed and available kernel packages: yum list kernel
  • List all available packages: yum list available
  • List all available packages from a repo: yum list available | grep <repo> or repoquery -qa --repoid=<repo>
  • List all installed packages: yum list installed
  • Show duplicates packages: yum list php-gd --showduplicates
  • List all packages with updates available in the yum repositories: yum list updates
  • List a description and summary information about package name: yum info git
  • Install a package: yum install samba
  • Reinstall a package: yum reinstall firefox
  • Install a package from a repo that have been disabled in the configuration file: yum --enablerepo=<reponame> install samba
  • Install a local rpm file: yum install /tmp/EMCPower.LINUX-6.2.0.00.00-051.RHEL7.x86_64.rpm
  • Remove the specified packages from the system (it does not resolve dependencies automatically): yum remove samba
  • List the packages to be updated: yum check-update
  • Display dependencies for a package: yum deplist firefox
  • List names of installed and available package groups: yum grouplist
  • Install all of the individual packages in a group: yum groupinstall "NFS file server"
  • Update all packages for a group: yum groupupdate "NFS file server"
  • Remove all of the packages in a group (does not do give you the same result as "groupinstall"): yum groupremove "NFS file server"
  • Display description and package list of a group: yum groupinfo "NFS file server"
  • Download the package and dependencies but do not install the packages (/var/cache/yum/arch/prod/repo/packages): yum install httpd --downloadonly
  • Download the package and dependencies to /tmp: yum install httpd --downloadonly --downloaddir=/tmp
  • Display enabled, disabled or all repositories: yum repolist enables| disabled | all
  • Display enabled software repositories: yum repolist
  • Find out which package provides some feature or file: yum whatprovides "*/fstab"
  • List all packages from a specific repository: yum --disablerepo="*" --enablerepo="<reponame>" list available
  • List packages providing the specified dependencies: yum resolvedep audioop.so
  • Downgrade a package to the last available version (it does not resolve dependencies automatically): yum downgrade firefox
  • View yum transactions: yum history
  • Show details of yum transaction 4: yum history info 4
  • Show all firefox transactions: yum history list firefox
  • Show details about all firefox transactions: yum history info firefox
  • Show the version of the packages for all transactions: yum history packages-list firefox
  • Undo the yum action from transaction 4: yum history undo 7
  • Redo the undone yum action from transaction 4: yum history redo 7
  • Undo all transactions up to the point of the specified transaction: yum history rollback 7
  • Query local or remote RPM database (like rpm -ql package): repoquery -ql httpd
  • Show duplicates: repoquery php-gd --show-duplicates
  • Download a package from a repo to current directory: yumdownloader --destdir /tmp kernel

Repackage - RHEL 5

Repackaged files will be stored in /var/spool/repackage

vi /etc/yum.conf

tsflags=repackage

vi /etc/rpm/macros

%_repackage_all_erasures 1

Commands

  • rpm -Uhv --rollback "10:00 am"
  • rpm -Uhv --rollback "8 hours ago"
  • rpm -Uhv --rollback "june 26"
  • rpm -Uhv --rollback "yesterday"

Plugins

yum-utils plugin

yum install yum-utils

  • Remove old kernels

Manually - keep only the last 2 versions of the kernel

package-cleanup --oldkernels --count=2

Automatically - keep only the last 2 versions of the kernel

vi /etc/yum.conf

installonly_limit=2
  • Scan for duplicates in the local RPM database: package-cleanup --dupes
  • Scan for duplicates in the local RPM database and clean out the older versions: package-cleanup --cleandupes
  • List dependency problems in the local RPM database: package-cleanup --problems
  • Find incomplete or aborted yum transactions on a system and attempts to complete them: yum-complete-transaction
  • List installed packages which are not available from currenly configured repositories: package-cleanup --orphans
  • Find packages not required by other packages: package-cleanup --leaves
  • Query all packages that provide capability: repoquery -a --whatprovides 'perl(Net::HTTP)'
  • Find Repository of Installed Packages: find-repos-of-install wget
  • Output a full package dependency graph in dot format: repo-graph --repoid=epel
  • Display a list of unresolved dependencies for a yum repository: repoclosure
  • List files in package: repoquery --list mlocate
  • Synchronize a remote yum repo to a local directory: reposync --repoid=epel --download_path=/tmp
  • List the description for all tools: man yum-utils

yum-plugin-security

Installation:

RHEL 7: nothing, part of yum itself
RHEL 6: yum install yum-plugin-security
RHEL 5: yum install yum-security
  • List all updates that are security relevant: yum --security check-update
  • Upgrade all packages that have security errata: yum --security update
  • List all updates that are critical: yum updateinfo list --security --sec-severity=Critical
  • Upgrade all packages that are critical: yum update --security --sec-severity=Critical
  • Show the summary of errata notice information (bugzillas, CVEs, security updates): yum updateinfo summary
  • Show the CVEs for all available updates: yum updateinfo list cves
  • Show detailed info about a CVE: yum updateinfo info --cve CVE-2017-5470
  • Update the package for a specific CVE: yum update --cve CVE-2017-5470

https://access.redhat.com/solutions/10021
https://access.redhat.com/solutions/55654

yum-plugin-changelog

Installation: yum-plugin-changelog

  • View all kernel package changelogs: yum changelog all kernel
  • View latest kernel package changelog: yum changelog 1 kernel
  • Listing changelogs since: Jan 2017: yum changelog 2017-Jan kernel\*
  • View changelogs for all updates before update: yum update --changelog
  • List all options: yum help changelog

yum-plugin-fs-snapshot

Installation: yum install yum-plugin-fs-snapshot

https://access.redhat.com/solutions/44026
https://access.redhat.com/node/31889

yum-plugin-protectbase

Installation:

  • RHEL 5: yum install yum-protectbase
  • RHEL 6: yum install yum-plugin-protectbase

Configuration file: /etc/yum/pluginconf.d/protectbase.conf

https://wiki.centos.org/PackageManagement/Yum/ProtectBase

Important files

  • Main configuration file: /etc/yum.conf
  • YUM repository configuration files: /etc/yum.repos.d
  • Plugins configuration files: /etc/yum/pluginconf.d
  • Configuration file for kernel: /etc/sysconfig/kernel

Links