How To Install Yum In Linux : Yum Package Manager Installation Method

The Yellowdog Updater Modified, or YUM, can be installed on Linux systems that use RPM packages. If you are wondering how to install yum in linux, this guide will walk you through every step. YUM simplifies package management by automating updates, installs, and removals. You don’t need to be a Linux expert to follow along.

Many modern distributions like CentOS, RHEL, and Fedora come with YUM pre-installed. However, older systems or minimal installations might lack it. This article covers multiple methods to get YUM running on your machine.

Understanding YUM And Its Role In Linux

YUM is a command-line tool for managing RPM packages. It resolves dependencies automatically, saving you from manual downloads. Think of it as a smart assistant for software installation.

Before diving into the installation process, you should know which Linux distribution you are using. YUM works best on Red Hat-based systems. If you are on Debian or Ubuntu, you would use APT instead.

Why You Might Need To Install YUM

Some minimal installations skip YUM to save space. For example, Docker containers or cloud images often exclude it. If you need to install software quickly, YUM is essential.

Another scenario is when you switch from a different package manager. YUM offers a familiar interface for RPM-based distros. It also integrates well with repositories like EPEL.

Prerequisites For Installing YUM

Before you start, ensure your system meets these requirements. You need root or sudo access to install packages. Also, verify that your system uses RPM packages.

  • A Linux distribution based on Red Hat (CentOS, RHEL, Fedora)
  • Active internet connection for downloading packages
  • Basic familiarity with the terminal
  • At least 100 MB of free disk space

If you are unsure about your distribution, run cat /etc/os-release in the terminal. This command shows your OS details.

How To Install Yum In Linux

Now let’s get to the main part. Follow these steps carefully. The exact method depends on your current package manager.

Method 1: Using DNF (For Fedora And RHEL 8+)

DNF is the successor to YUM. If you have DNF installed, you can use it to install YUM. This method works on Fedora 22+ and RHEL 8+.

  1. Open a terminal window.
  2. Update your system: sudo dnf update
  3. Install YUM: sudo dnf install yum
  4. Verify installation: yum --version

That’s it. DNF will pull YUM along with its dependencies. You might see a prompt to confirm the installation. Type ‘y’ and press Enter.

Method 2: Using RPM (For Minimal Systems)

If your system has no package manager, you can install YUM via RPM. This is common in Docker containers or very old systems.

  1. Download the YUM RPM package from a trusted repository. For example, from the CentOS vault.
  2. Use wget or curl: wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
  3. Install the package: sudo rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm
  4. Resolve dependencies manually if needed. You may need to download additional RPMs.

This method can be tedious because you must handle dependencies yourself. It is better to use DNF if available.

Method 3: From Source (Advanced Users)

Compiling YUM from source is possible but not recommended. It requires Python and other tools. Only try this if you have no other option.

  1. Download the source code from the official repository.
  2. Extract the tarball: tar -xzf yum-*.tar.gz
  3. Run python setup.py install as root.
  4. Configure repositories manually.

Most users should stick with the first two methods. Source installation is complex and error-prone.

Configuring YUM After Installation

Once YUM is installed, you need to configure repositories. Without repositories, YUM cannot find packages. The main configuration file is /etc/yum.conf.

Repository files are stored in /etc/yum.repos.d/. You can add official repos like EPEL or base repositories.

Adding The EPEL Repository

EPEL (Extra Packages for Enterprise Linux) provides additional software. To enable it, run:

sudo yum install epel-release

This command installs the EPEL repository configuration. After that, you can install packages from EPEL.

Verifying Repository Access

Run yum repolist to see all enabled repositories. If the list is empty, check your configuration files. Ensure they have correct URLs.

Common Issues And Fixes

Even with proper steps, you might encounter problems. Here are common issues and their solutions.

Yum Command Not Found

If you get “command not found”, the installation might have failed. Check if YUM is installed: rpm -qa | grep yum. If not, reinstall using DNF or RPM.

Dependency Errors

YUM relies on Python and other libraries. If you see missing dependencies, install them first. Use sudo dnf install python or download the required RPMs.

Repository Connection Failures

Network issues can prevent YUM from reaching repositories. Check your internet connection. Also, verify that the repository URLs are correct.

If you are behind a proxy, configure it in /etc/yum.conf by adding proxy=http://proxy-server:port.

Using YUM For Package Management

Now that YUM is installed, you can use it to manage packages. Here are basic commands.

  • Install a package: sudo yum install package-name
  • Update all packages: sudo yum update
  • Remove a package: sudo yum remove package-name
  • Search for a package: yum search keyword
  • List installed packages: yum list installed

YUM also supports group installations. For example, sudo yum groupinstall "Development Tools" installs a set of related packages.

Keeping YUM Updated

YUM itself can be updated like any other package. Run sudo yum update yum to get the latest version. This ensures you have bug fixes and new features.

Alternatives To YUM

While YUM is powerful, other tools exist. DNF is the modern replacement and is faster. Some users prefer Zypper on openSUSE.

If you are on a non-RPM system, consider using APT or Pacman. Each has its own syntax but serves the same purpose.

When To Stick With YUM

If you are maintaining legacy systems, YUM is often the only option. Many enterprise environments still rely on CentOS 7 or RHEL 7. In such cases, YUM is stable and well-tested.

Security Considerations

Always download YUM from official sources. Using third-party repositories can introduce malware. Verify GPG keys when prompted.

Keep your system updated to patch vulnerabilities. YUM makes this easy with the update command.

Frequently Asked Questions

Can I Install YUM On Ubuntu?

No, Ubuntu uses APT. However, you can install YUM via sudo apt install yum, but it is not recommended. It may cause conflicts.

What Is The Difference Between YUM And DNF?

DNF is the next-generation version of YUM. It has better performance and dependency resolution. YUM is older but still functional.

How Do I Uninstall YUM?

Run sudo yum remove yum or sudo dnf remove yum. Be careful, as this might break other packages.

Why Is YUM Not Found After Installation?

Check if the installation path is in your PATH variable. Also, ensure you installed the correct version for your architecture.

Can I Use YUM Without Internet?

Yes, you can set up a local repository. Download packages on another machine and transfer them via USB. Configure the repo path in /etc/yum.repos.d/.

Conclusion

Learning how to install yum in linux is a valuable skill for system administrators. YUM simplifies package management and saves time. Whether you use DNF, RPM, or source, the process is straightforward.

Remember to configure repositories after installation. This ensures YUM can find and install packages. Keep your system updated for security and stability.

If you encounter issues, refer to the troubleshooting section. Most problems have simple solutions. With YUM installed, you can manage software efficiently on any RPM-based Linux system.