How To Install Yum On Linux : Yum Repository Configuration On Linux

For Red Hat-based distributions, installing YUM provides a reliable package management tool. This guide walks you through exactly how to install yum on linux step by step. Whether you’re using CentOS, RHEL, or Fedora, you’ll find clear instructions here.

YUM (Yellowdog Updater Modified) simplifies installing, updating, and removing software packages. It handles dependencies automatically, saving you time and frustration. Many older systems still rely on YUM, making it essential knowledge for Linux administrators.

Understanding YUM And Its Role In Linux

YUM works with RPM packages to manage software on Red Hat-based systems. It connects to repositories, downloads packages, and resolves dependencies. While DNF has replaced YUM in newer distributions, many legacy systems still use YUM.

Before installing, check if your system already has YUM. Run yum --version in your terminal. If you see a version number, you’re good to go. If not, proceed with the installation steps below.

Prerequisites For Installing YUM

You need root or sudo access to install software on Linux. Make sure your system has internet connectivity to download packages. Also verify your distribution version, as steps vary slightly between CentOS, RHEL, and Fedora.

  • Root or sudo privileges
  • Active internet connection
  • Basic familiarity with terminal commands
  • Your Linux distribution name and version

How To Install Yum On Linux

Now we get to the core of this guide. Follow these methods depending on your specific Linux distribution. Each approach works reliably when executed correctly.

Method 1: Installing YUM On CentOS 7

CentOS 7 comes with YUM pre-installed. But if it’s missing, you can install it easily. Start by updating your package cache.

  1. Open a terminal window
  2. Run sudo yum update to refresh repositories
  3. If yum isn’t found, use sudo rpm -Uvh http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
  4. Verify installation with yum --version

This method downloads the YUM RPM package directly from CentOS repositories. It works even when YUM itself isn’t available.

Method 2: Installing YUM On RHEL 7

Red Hat Enterprise Linux 7 also includes YUM by default. However, minimal installations might lack it. Use these steps to add YUM to your RHEL system.

  1. Log in as root or use sudo
  2. Check if yum is installed: rpm -qa | grep yum
  3. If missing, download the yum RPM from Red Hat’s repository
  4. Install using rpm -ivh yum-*.rpm
  5. Configure repositories in /etc/yum.repos.d/

RHEL requires a subscription for full repository access. Without it, you’ll need to configure third-party repositories like EPEL.

Method 3: Installing YUM On Fedora

Fedora switched to DNF starting with version 22. But you can still install YUM if needed. Fedora’s package manager handles this seamlessly.

  1. Open terminal
  2. Run sudo dnf install yum
  3. Confirm installation when prompted
  4. Test with yum --version

DNF automatically resolves dependencies for YUM. This method is the simplest for Fedora users who need YUM for compatibility reasons.

Method 4: Installing YUM On Older Distributions

Systems like CentOS 6 or RHEL 6 may need YUM installed manually. These versions are outdated but still found in some enterprise environments.

  1. Download the yum RPM from vault.centos.org
  2. Install dependencies first: python, rpm-python, yum-metadata-parser
  3. Run rpm -ivh yum-*.rpm
  4. Configure base repositories
  5. Run yum update to test

Be careful with older distributions. They may lack security updates and proper repository support.

Verifying YUM Installation

After installation, confirm YUM works correctly. Run a few basic commands to test functionality. This ensures everything is set up properly.

  • yum --version – Shows version information
  • yum list installed – Lists installed packages
  • yum repolist – Shows configured repositories
  • yum check-update – Checks for available updates

If any command fails, check your repository configuration. Common issues include missing repo files or incorrect URLs.

Common Installation Errors And Fixes

You might encounter errors during installation. Here are typical problems and their solutions.

Error: No package yum available
This usually means repositories aren’t configured. Add EPEL repository or manually specify the RPM URL.

Error: Failed to download metadata
Check your internet connection and repository URLs. Update your system time with sudo ntpdate pool.ntp.org.

Error: rpmdb open failed
The RPM database might be corrupted. Rebuild it with sudo rpm --rebuilddb.

Configuring YUM Repositories

YUM relies on repositories to find packages. Without proper configuration, installation commands fail. Set up repositories after installing YUM.

Repository files live in /etc/yum.repos.d/. Each file ends with .repo. You can create or edit these files manually.

Adding EPEL Repository

EPEL (Extra Packages for Enterprise Linux) provides additional packages. It’s essential for many software installations.

  1. Install EPEL release package: sudo yum install epel-release
  2. Verify repository is enabled: yum repolist
  3. Update package cache: sudo yum update

EPEL works on CentOS, RHEL, and Scientific Linux. It’s maintained by the Fedora project and is very reliable.

Creating Custom Repository Files

Sometimes you need to add third-party repositories. Create a new .repo file with the correct syntax.

Example repository file content:

[myrepo]
name=My Custom Repository
baseurl=http://example.com/repo
enabled=1
gpgcheck=0

Replace the URL with your actual repository address. Enable GPG checking if the repository provides a GPG key.

Using YUM After Installation

Now that YUM is installed, learn basic commands. These help you manage packages efficiently.

Installing Packages

Use sudo yum install package-name. Replace “package-name” with the actual software you want.

Example: sudo yum install httpd installs Apache web server. YUM automatically downloads and installs all dependencies.

Updating Packages

Keep your system updated with sudo yum update. This updates all installed packages to their latest versions.

To update a single package, use sudo yum update package-name. This is useful when you want to avoid updating everything at once.

Removing Packages

Remove software with sudo yum remove package-name. YUM also removes dependencies that aren’t needed by other packages.

Be careful when removing packages. Some dependencies might be shared with other software you use.

YUM Vs DNF: What’s The Difference

Modern distributions use DNF instead of YUM. DNF is the next-generation package manager with better performance and dependency resolution.

YUM uses Python 2, which is now deprecated. DNF uses Python 3 and offers faster operations. However, YUM still works well on older systems.

If you’re on a newer distribution, consider using DNF. The commands are similar, making transition easy.

When To Use YUM Instead Of DNF

Stick with YUM if you’re maintaining legacy systems. Many enterprise environments still run CentOS 7 or RHEL 7.

Some scripts and automation tools expect YUM commands. Switching to DNF might break these workflows.

YUM also has a larger knowledge base online. Troubleshooting YUM issues is often easier due to extensive documentation.

Security Considerations For YUM

Package management involves security risks. Always verify package signatures and use trusted repositories.

Enable GPG checking in your repository files. This ensures packages haven’t been tampered with during download.

Keep YUM itself updated. Older versions might have security vulnerabilities that attackers can exploit.

Checking Package Signatures

Run rpm -K package.rpm to verify a package signature. This checks the GPG signature against imported keys.

Import repository GPG keys with sudo rpm --import key-url. Most repositories provide key URLs in their documentation.

Advanced YUM Usage

Beyond basic commands, YUM offers powerful features. Learn these to become more efficient.

Using YUM Groups

YUM groups install related packages together. For example, sudo yum groupinstall "Development Tools" installs compilers and libraries.

List available groups with yum group list. This helps you install complete software stacks quickly.

YUM History And Rollbacks

YUM keeps a history of transactions. View it with yum history. You can undo or redo transactions as needed.

To undo the last transaction, run sudo yum history undo last. This reverts changes made by the previous YUM command.

Downloading Packages Without Installing

Use yumdownloader to download RPMs without installing. This is useful for offline installations or sharing packages.

Install yum-utils first: sudo yum install yum-utils. Then use yumdownloader package-name.

Troubleshooting YUM Issues

Even with proper installation, problems can occur. Here are solutions to common YUM issues.

Slow YUM Operations

YUM can be slow on large repositories. Enable fastestmirror plugin to speed things up.

Install the plugin: sudo yum install yum-plugin-fastestmirror. It automatically selects the fastest mirror for downloads.

Repository Metadata Errors

Clear YUM cache with sudo yum clean all. This removes old metadata and forces fresh downloads.

If errors persist, check your repository files for typos. Incorrect URLs are a common cause of metadata errors.

Dependency Conflicts

Sometimes packages have conflicting dependencies. Use yum deplist package-name to see what dependencies are required.

Consider using yum --skip-broken update to skip problematic packages. This lets you update everything else while troubleshooting the conflict.

Frequently Asked Questions

Q: Can I install YUM on Ubuntu or Debian?
A: No, YUM is designed for Red Hat-based systems. Ubuntu uses APT, and Debian uses DPKG. You can’t install YUM on these distributions.

Q: What is the difference between YUM and RPM?
A: RPM installs individual packages, while YUM handles dependencies and repositories. YUM uses RPM as its backend package manager.

Q: How do I know if YUM is already installed?
A: Run yum --version in terminal. If you see version output, YUM is installed. If you get “command not found”, it’s not installed.

Q: Is YUM still supported in 2025?
A: YUM is deprecated in favor of DNF. However, it still works on older distributions like CentOS 7 and RHEL 7. Newer distributions use DNF exclusively.

Q: Can I use YUM on Fedora 40?
A: Yes, but you need to install it via DNF. Run sudo dnf install yum. However, Fedora recommends using DNF instead.

Conclusion

Installing YUM on Linux is straightforward once you understand your distribution. Whether you’re on CentOS, RHEL, or Fedora, the steps are clear and reliable. YUM remains a valuable tool for managing packages on older systems.

Remember to configure repositories after installation. Without proper repositories, YUM can’t find packages to install. EPEL is a great starting point for additional software.

Practice using YUM commands to become comfortable with package management. Start with simple installations and gradually explore advanced features like groups and history.

If you encounter issues, refer to the troubleshooting section above. Most problems have simple solutions like clearing cache or checking repository files.

YUM might be older technology, but it’s still widely used in enterprise environments. Mastering YUM gives you skills that transfer to DNF and other package managers.

Keep your system updated regularly. Security patches and bug fixes are released frequently through YUM repositories.

Thank you for reading this guide on how to install yum on linux. With these instructions, you should have YUM running smoothly on your system.