Configuring Yum

Introduction

Yum (Yellowdog Updater, Modified) is a package manager for Red Hat based Linux distributions, including Fedora and CentOS. It helps in managing and updating the software packages on the system, including their dependencies and conflicts. In this article, we will learn how to configure Yum to manage packages on your Linux system.

Setting up Yum Repositories: The first step in configuring Yum is to set up Yum repositories. A Yum repository is a collection of RPM packages and metadata that are stored on a server. Yum uses these repositories to download and install packages on your system.

There are two types of Yum repositories:

  1. Official Repositories: These are the repositories that are maintained by the Linux distribution provider and are included by default with the operating system. They contain the latest stable packages and are updated regularly.
  2. Third-Party Repositories: These are repositories that are maintained by third-party organizations or individuals and contain packages that are not included in the official repositories. They may contain packages that are not stable, and it is important to choose a reputable repository before using it.

To view the available Yum repositories, use the following command:

yum repolist

To enable or disable a repository, you can use the following command:

yum-config-manager --enable <repo-id>
yum-config-manager --disable <repo-id>

Adding Custom Yum Repositories

If you want to add a custom Yum repository to your system, you need to create a .repo file in the /etc/yum.repos.d/ directory. The file should contain the following information:

[repo-id]
name=Repository name
baseurl=https://example.com/repo/
enabled=1
gpgcheck=0

The “repo-id” should be a unique identifier for the repository, “name” is the name of the repository, “baseurl” is the URL of the repository, “enabled” is set to 1 to enable the repository and “gpgcheck” is set to 0 if you do not want to check the repository’s GPG signature.

Note: It is important to verify the GPG signature of a repository before using it. This helps ensure that the packages have not been modified and that they are from a trusted source.

Updating Yum Repositories

It is important to update the Yum repositories regularly to ensure that you have the latest packages and security updates. To update the Yum repositories, use the following command:

yum update

Installing Packages with Yum

Once you have set up the Yum repositories, you can install packages using the following command:

yum install <package-name>

For example, to install the “nano” text editor, use the following command:

yum install nano

Upgrading Packages with Yum

Yum can also be used to upgrade packages to the latest version. To upgrade a package, use the following command:

yum upgrade <package-name>

For example, to upgrade the “nano” text editor, use the following command:

yum upgrade nano

Removing Packages with Yum

If you no longer need a package, you can remove it using Yum. To remove a package, use the following command:

yum remove <package-name>

For example, to remove the “nano” text editor, use the following command:

yum remove nano

Note: Be careful when removing packages, as they may have dependencies that will also be removed.

Searching for Packages with Yum

Yum also allows you to search for packages by name or description. To search for a package, use the following command:

yum search <keyword>

For example, to search for a package containing the word “editor,” use the following command:

yum search editor

Cleaning Yum Cache

Over time, Yum will accumulate cached packages and metadata in its cache directory. This can take up a significant amount of disk space. To clean the Yum cache, use the following command:

yum clean all

Conclusion

In this article, we have learned how to configure Yum to manage packages on a Linux system. We have seen how to set up Yum repositories, install and upgrade packages, remove packages, search for packages, and clean the Yum cache. Yum is a powerful tool for managing software packages, and with the information covered in this article, you should be able to get started with using Yum on your Linux system.

Related Articles