The yum and dnf are the command line package management utilities that can be used for installation, updating, and removal of a software package. These are used in the CentOS, Fedora, and other similar Linux distributions. Centos is a community-supported distribution designed as an opensource version of RHEL(Red Hat Enterprise Linux) while fedora is another Linux distribution that is sponsored by Red Hat and supported by the community. As we already discussed the software packages, package manager, apt, apt-get, dpkg, and aptitude command in Package management In debian based Linux distributions. Now we will discuss the yum, dnf, and rpm commands in this article.
Yellow Dog Updater Modified(yum)
It was originally developed for Yellow Dog Linux(YDL) as a replacement for yellow dog updater. Later it was used by Redhat and today it becomes the default tool for various operating systems like OpenSUSE, Mandrake Linux, CentOS, including Red Hat Enterprise Linux, etc.
yum Commands –
yum install package_name
– Install a package in the system
yum erase package_name
– Remove the package from the system
yum search Package_to_search
– Will display the related packages
yum check-update
– Update the package and dependencies
yum info package_name
-Shows the information like name, description, version of the package
yum reinstall package_name
– Erase and reinstall the package by downloading it again
yum localinstall file_name.rpm
– Install a local .rpm file by checking required dependencies
yum update optional_package_name
– Update the system by downloading files if you mention a package name it will also download and install it
yum upgrade
– Upgrade the system if a newer version of a package is available
yum, download and update the system from repositories that are mention in /etc/yum.repos.d and /etc/yum.conf provides system-wide configuration option for yum.
Dandified Yellow Dog Updater Modified(DNF)
DNF is an updated version of yum which can also be used for install, remove and update a package. It was introduced in Fedora 18 and has been default package manager of fedora since Fedora 22 release. It was launched to address issues like poor performance, high memory usage and slowness of its iterative dependencies resolution in Yum.
dnf commands –
dnf install package_name
– Download and install the package if .rpm file is provided instead of package_name it also will be accepted and installed.
dnf remove package_name
– Remove the installed package along with dependencies
dnf search String_to_search
– This will list the packages along with there description
dnf provides package_name
– List all the libraries and modules on which a given package depends.along with the package info which provides those dependencies
dnf check-update
– Will check and update the cache of dnf local database so that package are always up to date
dnf info package_name
– Show the information including name and description of package
dnf reinsatall package_name
– Erase and then downloads a new copy of the package file and reinstall it into system
dnf upgrade package_name_optional
– Will upgrade the packages by downloading all the updates and bugfixes and also upgrade the mentioned package
dnf upgrade
– Upgrade the system as a whole to new release
dnf config-manager --add repo example.repo
– Adds a .repo file as DNF repository
dnf config-manager --set-enabled example.repo
– Enables a DNF repository
dnf config-manager --set-disabled example-repo
– Disables a DNF repository
The dnf.conf file provides a global configuration setting for DNF. And /etc/yum.repos.d contains the repository details.
RPM package manager
Yum and Dnf are simply front ends these can fetch a package from a remote location and resolves the dependencies. While rpm is a lower level tool that works with .rpm packages like dpkg works with .deb files in debian based systems.
rpm commands –
rpm -ivh package_name.rpm
– Install a package into the system where -i is install-switch v is verbose in case the system fails installation h is an option which shows the installation progress bar with a #(hash) symbol
rpm -Uvh package_name.rpm
– Will upgrade the previously installed package into new version where -U is an upgrade switch
rpm -e package_name
or rpm --erase package_name
– Will remove a package from the system
rpm -e --nodeps package_name
– Will remove the package by avoiding dependency check
rpm -Va
– Will verify all of the files on your system. It verifies a package information from the files that are taken from the original package stored in the rpm database. Verifying compares the size, MD5 sum, permission, type, owner and group of each file and displays only discrepancies.
rpm -ivh --force package_name.rpm
– Install a package forcefully –force can also be used for removing a package forcefully
rpm --query package_name
or rpm -q package_name
– Will check a specific package is installed or not
rpm --query all
or rpm -qa
– Will show the list of all packages installed on your system
rpm --query info package_name
or rpm -qi package_name
– Displays the information about the installed package
rpm --query --list Package_name
orrpm -ql package_name
– Generates a list of files installed by the given package