Mastering YUM on RHEL/CentOS/AlmaLinux

YUM – Package managers are essential tools in every Linux distribution. They simplify the process of installing, updating, configuring, and removing software packages from a system. Instead of manually downloading and compiling source code, package managers automate dependency resolution and ensure software integrity through trusted repositories.

There are two major types of package formats in Linux:

  • DEB (Debian-based) – used by Ubuntu, Debian, Linux Mint, etc., with tools like apt and dpkg.
  • RPM (Red Hat-based) – used by RHEL, CentOS, Fedora, AlmaLinux, etc., with tools like yum, dnf, and rpm.

Package managers not only streamline software management but also support automation, security patching, and repository integration—making them indispensable in both personal and enterprise environments.

In this guide, we’ll focus on YUM, the traditional package manager for RPM-based distributions, and explore how to manage software locally and from the cloud.

Table of Contents

  1. What is YUM?
  2. DNF vs YUM: What Changed?
  3. How YUM Works: Under the Hood
  4. YUM Repositories Explained
  5. Default YUM Repositories on RHEL/CentOS/AlmaLinux
  6. Creating a Custom YUM Repository
  7. Using a Local YUM Repository (Offline Installations)
  8. Hosting YUM Repositories Over HTTP/FTP/Cloud
  9. Basic YUM Commands
  10. Useful YUM Plugins
  11. YUM Logs and Troubleshooting
  12. Conclusion

1. What is YUM?

YUM (Yellowdog Updater, Modified) is the traditional package manager for RPM-based Linux distributions like:

  • Red Hat Enterprise Linux (RHEL)
  • CentOS
  • AlmaLinux
  • Oracle Linux

YUM handles:

  • Dependency resolution
  • Installation of RPM packages
  • Automatic updates
  • Repository management

📝 Note: YUM has been replaced by DNF in RHEL 8+, but the yum command still works as a wrapper.

2. DNF vs YUM: What Changed?

FeatureYUM (RHEL 7 and below)DNF (RHEL 8 and above)
Dependency handlingBasicAdvanced, better resolution
PerformanceSlowerFaster
PluginsPython 2-basedPython 3-based
Backward compatibleYes (via yum binary)Yes

3. How YUM Works: Under the Hood

  • YUM pulls metadata from repo configuration files in /etc/yum.repos.d/
  • Uses rpm to install .rpm packages after resolving dependencies
  • Downloads metadata (like repomd.xml, filelists.xml, etc.) to /var/cache/yum/
  • Maintains a transaction history

4. YUM Repositories Explained

A YUM repository is simply:

  • A collection of RPM packages
  • Metadata about the packages (created using createrepo)
  • A .repo file describing its location

Example .repo file:

[my-repo]
name=My Local Repo
baseurl=http://192.168.1.100/repos/myrepo/
enabled=1
gpgcheck=0

5. Default YUM Repositories on RHEL/CentOS/AlmaLinux

List current repos:

yum repolist

View repo info:

yum repoinfo base

YUM repo files live in:

/etc/yum.repos.d/

Each file uses .repo extension and contains one or more repo blocks.

6. Creating a Custom YUM Repository

Step 1: Install createrepo

sudo yum install createrepo -y

Step 2: Create a directory and copy .rpm files

mkdir -p /var/www/html/myrepo
cp *.rpm /var/www/html/myrepo/

Step 3: Create metadata

createrepo /var/www/html/myrepo/

Step 4: Create a .repo file

[localrepo]
name=Local YUM Repo
baseurl=file:///var/www/html/myrepo/
enabled=1
gpgcheck=0

Save it to: /etc/yum.repos.d/local.repo

7. Using a Local YUM Repository (Offline Installations)

This is useful when:

  • You’re in an air-gapped environment
  • No internet access is available
  • You want to share a curated set of RPMs

Copy the repo and RPMs to the target machine:

rsync -avz myrepo/ user@target-machine:/mnt/repo/

Mount if using DVD or ISO:

mount -o loop /path/to/rhel.iso /mnt

Use as local repo:

[local-iso]
name=ISO Repo
baseurl=file:///mnt/
enabled=1
gpgcheck=0

8. Hosting YUM Repositories Over HTTP/FTP/Cloud

Using Apache (HTTP):

  1. Install Apache:
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
  1. Place RPMs and generate repo:
sudo mkdir -p /var/www/html/repos/myrepo
sudo cp *.rpm /var/www/html/repos/myrepo/
sudo createrepo /var/www/html/repos/myrepo/
  1. Create a repo file:
[cloudrepo]
name=My HTTP Repo
baseurl=http://yourserverip/repos/myrepo/
enabled=1
gpgcheck=0

You can also use:

  • Amazon S3 buckets
  • FTP servers
  • GitHub Pages (for metadata + RPMs)

For S3, you’d sync your repo using:

aws s3 sync /path/to/repo s3://mybucket/myrepo/

Then use:

[mycloud]
baseurl=https://mybucket.s3.amazonaws.com/myrepo/
enabled=1
gpgcheck=0

9. Basic YUM Commands

TaskCommand
Install packageyum install httpd
Remove packageyum remove httpd
Update systemyum update
Clean cacheyum clean all
List available packagesyum list available
List installed packagesyum list installed
Search for packageyum search nginx
Show package infoyum info curl
Enable a repo temporarilyyum –enablerepo=epel install htop
Exclude package from updateAdd exclude=package-name in repo config

10. Useful YUM Plugins

Install YUM plugins:

yum install yum-utils -y

Examples:

  • yum-config-manager – manage repo configurations
  • yum-plugin-versionlock – lock versions
  • yum-plugin-fastestmirror – auto-pick fastest mirror

11. YUM Logs and Troubleshooting

Logs are located at:

/var/log/yum.log

Useful for:

  • Debugging failed installations
  • Tracking package changes
  • Auditing systems

Clear cache:

yum clean metadata
yum clean all

Check if repo is reachable:

curl http://your-repo-url/

12. Conclusion

YUM is still widely used in production environments, especially with RHEL 7, CentOS 7, and AlmaLinux setups. Even with DNF becoming standard, learning YUM helps in:

  • Offline installations
  • Custom RPM management
  • Automation and scripting

Key Takeaways:

✅ Easy to mirror or host your own RPM repos
✅ Perfect for enterprise environments
✅ Works with cloud and local setups
✅ Fully scriptable with CLI tools

By mastering YUM, you gain full control over software installations in RPM-based Linux systems, both in the cloud and in isolated networks.

Scroll to Top