How to use YUM command in Linux (Redhat based Distro's), Basic and common example of YUM Command.

YUM stand for Yellowdog Updater, Modified.

1) To Install a package:
# yum install package

# yum install httpd

2) To Remove a package:
yum remove package

# yum remove httpd

3) To Update a package:
#yum update package

#yum update httpd

4) To Search for a package:
#yum search package

#yum search httpd

5) To Find information about a package:

#yum info package

#yum info httpd

6) List packages containing a certain term:

# yum list term

# yum list httpd

7) To Find what package provides a particular file:
# yum whatprovides 'path/filename'

# yum whatprovides 'etc/httpd.conf'
# yum whatprovides '*/'

8) To Update all installed packages with kernel package :
# yum update

# yum update
9) To update a specific package:
# yum update <package-name>

# yum update openssh-server

10) To see all enable YUM repositories 

# yum repolist

11) List all Installed Packages using YUM
# yum list installed

12) Check for Available Updates using Yum

# yum check-update

13) List all available Group Packages

# yum grouplist

Install a Group Packages
# yum groupinstall 'MySQL Database'

14) List all Enabled and Disabled Yum Repositories
The following command will display all enabled and disabled yum repositories on the system.

# yum repolist all

15) Install a Package from Specific Repository

To install a particular package from a specific enabled or disabled repository, you must use –enablerepo option in your yum command.

# yum --enablerepo=epel install phpmyadmin

16) Clean Yum Cache
By default yum keeps all the repository enabled package data in /var/cache/yum/ with each sub-directory, to clean all cached files from enabled repository, you need to run the following command regularly to clean up all the cache and make sure that there is nothing unnecessary space is using

# yum clean all

17) View History of Yum

To view all the past transactions of yum command, just use the following command.

# yum history

Maintained By Amit Maheshwari