RPM vs YUM: Key Differences in Package Installation and Update Commands for Linux Systems


4 views

When working with RHEL-based Linux distributions (CentOS, Fedora, RHEL), you'll encounter two primary package management approaches. While both rpm and yum (now largely replaced by dnf in newer systems) handle package operations, they differ fundamentally in functionality and scope.

The rpm -ivh command performs a low-level installation of an RPM package file:

rpm -ivh package-name.rpm
# -i: Install package
# -v: Verbose output
# -h: Show progress bar

Key characteristics:

  • Works directly with .rpm files
  • No dependency resolution
  • No repository awareness
  • Manual version management

The yum install command provides a higher-level interface:

yum install package-name
# Or modern equivalent:
dnf install package-name

Advantages include:

  • Automatic dependency resolution
  • Repository integration
  • Transaction history
  • Version conflict handling

For package updates, the differences are equally significant:

# RPM forced upgrade (may leave orphaned dependencies)
rpm -Uvh package-name.rpm

# YUM clean update (maintains system consistency)
yum update package-name

When to use rpm:

  • Installing local package files without internet access
  • Testing specific package versions
  • Low-level system debugging

When to use yum/dnf:

  • Day-to-day package management
  • Production environment maintenance
  • When dependency management is crucial

Mixing RPM and YUM operations can lead to:

  • Broken dependencies ("dependency hell")
  • Inconsistent package states
  • Difficulty tracking installed packages

For example, running rpm -Uvh without cleaning up old dependencies may cause issues that yum can't automatically resolve later.

For developers creating custom packages:

# Build RPM from source
rpmbuild -ba package.spec

# Then install either way:
rpm -ivh ~/rpmbuild/RPMS/x86_64/package.rpm
# OR better:
yum localinstall ~/rpmbuild/RPMS/x86_64/package.rpm

For system administrators managing repositories:

# List available packages in repos
yum list available | grep nginx

# Show dependencies before install
yum deplist package-name

When working with RHEL-based Linux distributions like CentOS or Fedora, you'll primarily encounter two package management approaches:

# Direct RPM installation
rpm -ivh package.rpm

# YUM-based installation
yum install package

The most critical distinction lies in dependency resolution:

# RPM will fail if dependencies aren't met
rpm -ivh httpd-2.4.6-90.el7.x86_64.rpm
error: Failed dependencies:
    httpd-tools = 2.4.6-90.el7 is needed by httpd-2.4.6-90.el7.x86_64

# YUM automatically resolves and installs dependencies
yum install httpd
--> Processing Dependency: httpd-tools = 2.4.6-90.el7 for package: httpd-2.4.6-90.el7.x86_64

YUM operates with configured repositories while RPM works with local files:

# RPM requires exact file location
rpm -ivh /path/to/package.rpm

# YUM searches repositories
yum install package

YUM maintains a transaction history that enables powerful operations:

# View transaction history
yum history list httpd

# Rollback capability
yum history undo 15

The difference between installation methods extends to updates:

# RPM upgrade (-Uvh)
rpm -Uvh package-2.0.rpm  # Installs or upgrades
rpm -Fvh package-2.0.rpm  # Freshen (upgrade only if already installed)

# YUM update
yum update package  # Handles dependencies and repository checks

Use RPM when:
- You have a specific .rpm file
- Need to verify package integrity (rpm --checksig)
- Performing low-level package queries

Use YUM when:
- Working with repository packages
- Need dependency resolution
- Want transaction history and rollback capability

Sometimes you might combine both tools:

# Download package with dependencies using yumdownloader
yum install yum-utils
yumdownloader --resolve package

# Then install with rpm
rpm -ivh package*.rpm