YUM command (Yellowdog Updater Modified) is the traditional package manager for RedHat based systems. It is present in almost every RedHat based distro but isn’t the default in many of them now. It has been replaced by the newer DNF command. We have a separate article on DNF.
yum command Basic Usage
The general syntax of YUM command is
yum [options] <command> [<args>...]
Available commands include
install, search, query, etc.
args can be a package name, a group name, or subcommand(s) specific to the ‘command’.
Note: To install and remove packages, you need to have sudo privileges. Since I am already root( which is not a great idea but works for the purpose of demonstration), I won’t be prepending any command with sudo. But keep in your mind that you must prepend sudo while installing and removing packages.
Note: On modern systems(CentOS 8 specifically)
/usr/bin/yum is just a symlink to
dnf. So, running yum eventually runs
This doesn’t cause a problem as
dnf has almost the same syntax as
Managing packages using the yum command
Let’s now see how we can use the yum command to install/remove/query packages on our RedHat based system.
1. Search and Install packages
Let’s install Syncthing – the file-syncing application using the yum command. But you may not know the exact name of the package. It’s better to search for the package first. You can use the
search command of YUM for searching packages.
yum search syncthing
In our case, the name of the package is also
syncthing. Once you know the exact package name, you can use the
install command of YUM for installing that package.
yum install syncthing
2. List information about a package
To list more information about a package, use the
info command of YUM.
3. List all installed packages using yum
To see the list of installed packages, you can use the
list installed command of YUM.
yum list installed
Combined with the grep command, you can search whether a particular package is installed or not as follows
yum list installed | grep vim
If it didn’t produce any output, it means that the package is not installed. In that case.
4. Remove a package
To remove a package, use the
remove command of YUM.
yum remove syncthing
To remove all unneeded packages that were originally installed as dependencies, use the
5. Upgrade a package using the yum command
To upgrade all the packages that can be upgraded, use the
To upgrade a specific package, just add the name of the package, for example:
yum upgrade nftables
6. Search and Install package groups
Package groups are just multiple packages under a single name. These packages groups can be a whole server GUI, Security Tools, Administration Tools, etc. To see the list of groups, you can use the
group list command of YUM.
yum group list
To know which packages are there in a group package, just use the
group info command and give the name of the package. For “Security Tools” package, type
yum group info "Security Tools"
Note: You need to enclose the Group Package Name which has multiple words in quotes(” “).
Even if the Group package name is a single word, it is recommended that you use quotes.
Let’s install the Security Tools Group package using the
group install command.
yum group install "Security Tools"
7. List available or enabled repositories
To list all the available repositories, type
yum repolist all
To list all the enabled repositories, type
yum repolist enabled
8. List dependencies of a package
To list the dependencies of a package, use the
yum deplist syncthing
9. View history of installation/removal of packages
Sometimes, viewing your YUM history is a good idea especially if you want to repeat the installations on a different system. History can be viewed using the
history command of YUM.
This tutorial was about the yum command in Linux. Hope you had fun learning with us!