Managing Packages With Yum Command

Yum (Yellowdog Updater Modified) is an interactive, automated update program which can be used for maintaining systems using rpm by super users (root). It is used to check, install, remove or update to the latest version of a package or group of packages while ensuring that all dependencies are satisfied. Login as the root user to install and update the system.

WARNING! yum command only works with RHEL / CentOS Linux version 5.x or above. For RHEL 4.x and older version use up2date command.

Register my system with RHN

To register your system with RHN type the following command and just follow on screen instructions (CentOS user skip to next step):

rhn_register
  1. Viewing yum options:
    yum -h
  2. List all installed packages:
    rpm -qa
    yum list installed
    yum list |more
  3. Search for packages by name (e.g. Search httpd and all matching perl packages):
    yum list httpd
    yum list perl*
  4. Check if a package is installed (e.g. httpd):
    rpm -qa | grep httpd*
    yum list installed httpd
  5. Get detailed package descriptions (e.g. description of httpd package):
    yum info httpd
  6. View package dependencies. Most packages that come with a Linux distribution contain one or more dependencies. (e.g. httpd has openssl, zlib or PHP package)
    yum deplist httpd
  7. Check for new package versions:
    yum list updates
    yum check-update
  8. Update all of the outdated packages to newest versions.
    yum update
  9. Check and update specified package (e.g. httpd):
    yum update httpd
  10. Install specified packages [ RPM(s) ] (e.g. httpd & mssql):
    yum install httpd mssql
  11. Remove / Uninstall the specified packages [ RPM(s) ] (e.g. httpd)
    yum remove httpd
  12. Display the list of available packages:
    yum list all
  13. Display list of group software:
    yum grouplist
    Output will list a) Installed Groups and b) Available Groups
  14. Install all the default packages by group (e.g. Install all 'Development Tools' group packages):
    yum groupinstall "Development Tools"
  15. Update all the default packages by group (e.g. Update all 'Development Tools' group packages):
    yum groupupdate "Development Tools"
  16. Remove all packages in a group (e.g. Remove all 'Development Tools' group packages):
    yum groupremove "Development Tools"
  17. Install particular architecture package (e.g. If you are using 64 bit RHEL version it is possible to install 32 packages:
    yum install {package-name}.{architecture}
    yum install mysql.i386
  18. Display packages not installed via official RHN subscribed channels or repositories: (e.g. dag on CentOS)
    yum list extras
  19. Search all packages to find the one which holds the specified file e.g. if you are trying to figure out what you need to install to use bunzip2, type:
    yum provides bunzip2
    yum whatprovides bunzip2
    or find out what provides the /etc/yum.conf file:
    yum provides /etc/yum.conf
    yum whatprovides /etc/yum.conf
    Sample output:
    ...
    yum.noarch     2.4.0-0.fc4     installed
    Matched from:
    /etc/yum.conf
    This example shows that /etc/yum.conf is part of the yum.noarch package.
  20. You can use same command to list packages that satisfy dependencies:
    yum whatprovides {dependency-1} {dependency-2}
  21. Cleaning up the yum cache. The yum package manager maintains a cache of headers and files in /var/cache/yum. This cache can grow rather large over time, and can be cleaned with the yum "clean" option:
    yum clean all
  22. Refer to the yum command man page for more information:
    man yum

No comments:

Post a Comment