A Linux distro can be described as a collection of inter-dependent packages on top of the Linux kernel. Together, they offer an amazing experience. To keep the packages in order, a package manager is a must-have for every distro.
In the case of Fedora, YUM and DNF are two package managers. In this guide, we’ll check out how to set up and use YUM on Fedora.
YUM on Fedora
YUM is the primary package manager for Fedora that can query info about packages, fetch packages from repos, install/uninstall packages with automatic dependency solution, and update the entire system. YUM can also work with additional repos or package sources. To extend the functionality, YUM also supports many plugins.
YUM can perform the same tasks as RPM but in a more efficient and simpler manner. It also simplifies configuring your own repositories and RPM packages.
In the modern-day, YUM is being replaced by DNF, a modern-day package manager. It’s because YUM has some inherent issues like poor performance, high memory consumption, poor documentation, etc. However, it’s still worth learning YUM because Fedora, CentOS, and RHEL still support YUM as a valid package manager.
Installing YUM on Fedora
As one of the default package managers, YUM should come pre-installed with Fedora. Run the following commands to verify if YUM is installed:
$ yum --version
If YUM isn’t installed, then the following command will install YUM right away.
It’s time to learn how to use YUM– a full-fledged package manager with tons of features. This section demonstrates some of its most common and important commands.
Installing a package
To install a package, YUM requires the package name. Assuming you have the package name, run the following command to install it. YUM will automatically resolve and install all the necessary dependencies.
If there needs to install multiple packages, then just place all the package names separated by space.
When installing any package, YUM will ask for confirmation. If you want YUM to install the packages without asking any permission, then use the “-y” flag.
Install an RPM package
Various packages are directly available as RPM packages. While the default method of installing an RPM package is using the RPM tool, it’s recommended to use YUM to do so. If installed using YUM, the RPM package will be installed with all its dependencies (if available).
If there are multiple packages, then mention those as well.
It’s also possible to install an RPM package that’s available through a direct link. In the following example, YUM will download and install the RPM Fusion repo.
Removing a package
When a package is no longer needed, keeping it installed is redundant. To remove an unwanted package, use the following command structure:
YUM will ask for permission to perform the action. If you want YUM to not ask for permission, use the “-y” flag.
Same as installing multiple packages, YUM can also remove multiple packages.
Searching a package
In many situations, the exact package name for a certain app is hard to keep track of. In such situations, the built-in searching feature of YUM comes really handy.
To search for a certain package name with a search term, use the following command structure:
Updating a package
If there’s an update available for a certain package, it’s possible to individually update the package. By default, YUM will download and install the latest version of the package with dependencies.
Instead of updating individual packages, it’s more efficient to let YUM update the entire system. YUM will check and download all the available updates and install them accordingly.
First, check if there’s any update available.
If there’s any update available, the following command will install all of them:
Using the “list” function, YUM can print all the list of packages, installed or available. This function can also search for an available package with a specific name.
To list all the installed packages, run the following command. The output will be huge, so we’ll be piping the output to “less” for easier browsing.
To list all the matching packages with a specific search term, use the following command:
To list all the packages (installed and available), run the following command:
Information about a package
Before installation, YUM can show detailed info about a package, and it can be helpful in various situations. To check info about a package, run the following YUM command:
In Linux, a group is a bundle of a number of packages. A group will generally contain packages that are related to each other. For example, the group “Java Development” contains all the necessary tools for developing programs in the Java programming language.
The following command will list all the available groups.
To check the information about a group, run the following command:
To install a group, run the following command:
If a group is to be updated, run the following command:
To uninstall a group, run the following command:
YUM repositories are the primary sources for downloading and installing packages. Fedora comes with the Fedora repos by default. However, it’s possible to add/remove additional repositories.
First, check out all the currently active repositories.
If there are some disabled repos, those won’t show on this list. To list all the repositories, run the following command:
To install a specific package from a specific repo, use the flag “–enablerepo”. It works on both enabled or disabled repo.
Cleaning up YUM
YUM generates all the repo package data in the “/var/cache/yum” location; each repo with its own sub-directory. While the cache is important for YUM to provide the fastest possible performance, a corrupted cache may be a problem, and cleaning it up will solve the issue.
Now, perform a system update. YUM will automatically generate the caches again.
YUM is a powerful package manager. This guide demonstrates some of the most common usages of YUM. For quick help, check out the YUM help page.
For in-depth information about YUM, the man page is quite useful.