Since Software management is an essential part of operating system management, for that, this article explains yum basics and the common command and options, as this package manager allows install, update, remove, or search for packages.
Common Linux distributions come with its package manager, for instance, Debian and Ubuntu use APT. on the other hand, Redhat, CentOS, OEL, and Fedora provide Yum and DNF as their package manager.
Yum vs DNF
DNF is the new major upgrade of Yum, It’s short for Dandified YUM and It became the default Package manager in Fedora, CentOS 8, RHEL 8. besides all features DNF brings to the os, It has the same syntax as yum.
The main syntax as described in this pic : yum [options] [command] [package …]
To utilize Linux package managers, like yum or DNF. you should be a privileged account “root”.
Yum Commands
Though, man provide rich documentation for yum, it has too much information that confuses the reader. for that, This article will focus on the most used one
Package management
The following yum command used to manipulate packages.
search | Search package details for the given string. |
list | List a package or group of packages. for example: yum list htop |
install | Install a package or packages on your system. |
update | Update a package or packages on your system. |
erase | Remove a package or group of packages from your system. |
DNF repository management.
repolist | Display the configured software repositories. also, you can append the following option to control its output: all –> show all repositories in the systems. disabled –> show only disabled repositories. enabled –> show only enabled repositories it, it’s same as using repolist without any options. |
Yum Maintenace & troubleshooting
check | Check for problems in the rpmdb. |
clean | Remove cached data and free space. You need to append one of the following values to the command: All cache dbcache expire-cache headers metadata packages |
check-update | Check for available package updates. |
Options for YUM or DNF.
-4 | Resolve to IPv4 addresses only. besides, you can use -6 to resolve using IPv4 addresses. |
–disablerepo=<repoid> | Disable specific repositories by an id or a name. also, This option is mutually exclusive with –repo. |
–downloadonly | Download the resolved package without performing any rpm transaction, for example, install, upgrade, or erase package. |
–enablerepo=<repoid> | Enable additional repositories by an id or a global name. besides the currently available packages. |
–allowerasing | Allow erasing of installed packages to resolve dependencies. |
-b, –best | Try the best available package versions, Specifically, during dnf upgrade operation. |
–enhancement | Include packages that will improve the main package features. Applicable for the install, repoquery updateinfo, and upgrade commands. |
-y, –assumeyes | Automatically answer yes for all questions. |
DNF autocomplete
if you want to enable autocomplete for yum and DNF, Install python and bash-auto complete packages.
sudo dnf -y install python sudo yum -y install bash-completion bash-completion-extras
To conclude, These were the most used options and commands for yum command. however, it has many other features this article does not cover.