Explain yum in linux


YUM(Yellowdog Update Modified): yum is the primary tool for installing, deleting, querying, and managing Linux RPM(Redhat Package Manager)software packages from official software repositories (base) as well as other third-party repositories.

Yum Help command
# yum help

How to configure Local Yum repository

Mount ISO on mnt(or other) diretory
mount -o loop isoname.iso /mnt

If you use DVD media use below command
# mount -o loop /dev/sr0  /mnt

If you are configuring on Virtual machine
# mount /dev/cdrom /mnt
Or,
# mount -t iso9660 /dev/cdrom /mnt

Now create a repo file in yum direcoty
#cp /etc/media.repo /etc/yum.repos.d/localrepo.repo

Edit repo file /etc/yum.repos.d/localrepo.repo
[localrepo]
name=CentOS
baseurl="file:///location"
gpgcheck=0

How to clear yum cache data
#yum clean all

Install a package using yum
# yum install firefox
Or,
# yum install firefox –y

How to Uninstall/Remove a package
#yum remove firefox

How to Update package
#yum update vsftpd
Note: update option will allow you to upgrade your old package version to new.

How to check available Update package information
#yum updateinfo packagename
# yum updateinfo bind

How to list specific package
# yum list vsftpd

How to list all installed package
#yum list installed

How to list all installed and available package
# yum list all

How to know the information/Version/Release/Size about package
# yum info vsftpd
  
How to check dependency of a package
#yum deplist nfs-utils
Or,
#yum deplist vsftpd

How to know what package a file belongs to

#yum whatprovides filename
Example:
#yum whatprovides /etc/named.conf
Or,
# yum whatprovides  /etc/passwd

How to know what package a command belongs to

#yum whatprovides *bin/commandname
Example:
#yum whatprovides *bin/nslookup

Install all the default packages by group
#yum groupinstall "Development Tools"

Update all the default packages by group
#yum groupupdate "Development Tools"

Remove all packages in a group
# yum groupremove "Development Tools"

Show enabled repository
#yum repolist

How to downgrade a package to an earlier version
#yum downgrade packagename