Fedora

How to Setup and Use YUM on Fedora?

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:

$ which yum

$ yum --version

If YUM isn’t installed, then the following command will install YUM right away.

$ sudo dnf install yum

Using YUM

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.

$ sudo yum install <package_name>

If there needs to install multiple packages, then just place all the package names separated by space.

$ sudo yum install <package_1> <package_2>

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.

$ sudo yum -y install <package_1> <package_2>

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).

$ sudo yum install <rpm_package_path>

If there are multiple packages, then mention those as well.

$ sudo yum install <rpm_package_1> <rpm_package_2>

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.

$ sudo yum install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

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:

$ sudo yum remove <package_name>

YUM will ask for permission to perform the action. If you want YUM to not ask for permission, use the “-y” flag.

$ sudo yum -y remove <package_name>

Same as installing multiple packages, YUM can also remove multiple packages.

$ sudo yum remove <package_1> <package_2>

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:

$ yum search <search_term>

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.

$ sudo yum update <package_name>

Updating system

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.

$ sudo yum check-update

If there’s any update available, the following command will install all of them:

$ sudo dnf update

List packages

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.

$ yum list installed | less

To list all the matching packages with a specific search term, use the following command:

$ yum list <search_term>

To list all the packages (installed and available), run the following command:

$ yum list all | less

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:

$ yum info <package_name>

Group packages

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.

$ yum grouplist

To check the information about a group, run the following command:

$ yum groupinfo <group>

To install a group, run the following command:

$ sudo yum groupinstall <group>

If a group is to be updated, run the following command:

$ sudo yum groupupdate <group>

To uninstall a group, run the following command:

$ sudo yum groupremove <group>

Repositories

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.

$ yum repolist

If there are some disabled repos, those won’t show on this list. To list all the repositories, run the following command:

$ yum repolist all

To install a specific package from a specific repo, use the flag “–enablerepo”. It works on both enabled or disabled repo.

$ sudo yum --enablerepo=<repo> install <package>

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.

$ sudo yum clean all

Now, perform a system update. YUM will automatically generate the caches again.

$ sudo yum check-update

Final thoughts

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.

$ yum --help

For in-depth information about YUM, the man page is quite useful.

$ man yum

Happy computing!

About the author

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.