dotlinux blog

Where Does Yum Install Packages and What Are the Options?

If you’re using a Red Hat-based Linux distribution like RHEL, CentOS, or Fedora, you’ve likely encountered yum (Yellowdog Updater, Modified)—the default package manager for RPM (RPM Package Manager) systems. Yum simplifies installing, updating, and removing software by handling dependencies automatically, making it a cornerstone tool for system administration.

A common question among new and even intermediate users is: Where exactly does Yum install packages? Equally important is understanding the options Yum offers to customize installations, troubleshoot issues, or adapt to specific workflows. This blog dives deep into both topics, explaining Yum’s default installation paths, configuration, and key commands to master package management.

2026-01

Table of Contents#

  1. Where Does Yum Install Packages?
  2. Yum Configuration Files: How It Finds Packages
  3. Key Yum Installation Options
  4. Advanced Yum Options for Power Users
  5. Troubleshooting Yum Installations
  6. Conclusion
  7. References

Where Does Yum Install Packages?#

Yum is a front-end for RPM, so it inherits RPM’s default directory structure for installing packages. When you run yum install <package>, files are placed into standardized system directories based on their type (binaries, libraries, configs, etc.). Below is a breakdown of the most common paths:

Common Installation Directories#

DirectoryPurposeExample File/Use Case
/usr/bin/Executable binaries (user-facing tools)/usr/bin/python3, /usr/bin/nginx
/usr/sbin/System binaries (admin tools)/usr/sbin/httpd, /usr/sbin/firewalld
/usr/lib/Shared libraries (32-bit on 64-bit systems)/usr/lib/libssl.so
/usr/lib64/Shared libraries (64-bit systems)/usr/lib64/libpython3.so
/usr/share/Architecture-independent data (docs, icons)/usr/share/doc/nginx, /usr/share/icons
/etc/Configuration files/etc/nginx/nginx.conf, /etc/httpd/
/var/Variable data (logs, caches, spools)/var/log/nginx/access.log, /var/www/
/usr/share/man/Manual pages/usr/share/man/man1/ls.1.gz

How to Verify a Package’s Installation Paths#

To see exactly where a specific package was installed, use the rpm command (since Yum relies on RPM under the hood):

rpm -ql <package-name>  

Example: To list files for the nginx package:

rpm -ql nginx  

This will output all directories and files installed by nginx, such as /usr/sbin/nginx, /etc/nginx/nginx.conf, and /var/log/nginx/.

Yum Configuration Files: How It Finds Packages#

Yum uses configuration files to determine where to fetch packages (repositories), cache behavior, and other settings. Understanding these files helps troubleshoot repo issues or customize package sources.

1. Main Configuration File: /etc/yum.conf#

This file defines global Yum settings. Key directives include:

DirectivePurpose
[main]Starts the main configuration section (required).
cachedirPath to store cached RPM packages (default: /var/cache/yum/$basearch/$releasever).
keepcacheWhether to keep downloaded RPMs after installation (0 = delete, 1 = keep; default: 0).
debuglevelVerbosity of logs (0-10; default: 2).
logfilePath to Yum’s log file (default: /var/log/yum.log).
excludePackages to exclude from updates/installs (e.g., exclude=kernel*).

Example snippet from /etc/yum.conf:

[main]  
cachedir=/var/cache/yum/$basearch/$releasever  
keepcache=0  
debuglevel=2  
logfile=/var/log/yum.log  
exactarch=1  
obsoletes=1  
gpgcheck=1  
plugins=1  
installonly_limit=3  

2. Repository Files: /etc/yum.repos.d/#

Yum reads repository definitions from files in /etc/yum.repos.d/ (ending with .repo). These files tell Yum where to find package sources (e.g., official mirrors, third-party repos like EPEL).

A typical repo file (e.g., CentOS-Base.repo) looks like this:

[base]  
name=CentOS-$releasever - Base  
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra  
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/  
enabled=1  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  

Key repo directives:

  • [base]: Unique repo ID (must be unique across all .repo files).
  • name: Human-readable repo name.
  • baseurl/mirrorlist: URL(s) to the repo’s package directory (mirrorlist uses a dynamic list of mirrors; baseurl is a static URL).
  • enabled: Whether the repo is active (1 = enabled, 0 = disabled).
  • gpgcheck: Whether to verify package signatures (1 = check, 0 = skip).
  • gpgkey: Path to the GPG key for verifying packages.

3. Repository Priorities (Optional)#

To prioritize certain repos over others (e.g., official repos before third-party ones), install the yum-plugin-priorities package and add a priority directive to repo files (lower numbers = higher priority):

[epel]  
name=Extra Packages for Enterprise Linux 7 - $basearch  
baseurl=https://download.fedoraproject.org/pub/epel/7/$basearch  
enabled=1  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7  
priority=10  # Lower than official repos (e.g., priority=5)  

Key Yum Installation Options#

Yum offers a variety of options to tailor installations. Below are the most frequently used commands for installing packages.

1. Basic Installation#

Install a package and its dependencies:

yum install <package-name>  

Example: Install nginx:

yum install nginx  

2. Install a Specific Version#

By default, Yum installs the latest available version. To install an older version, specify the version number:

yum install <package-name>-<version>  

Example: Install nginx version 1.16.1:

yum install nginx-1.16.1-3.el7  

3. Install from a Local RPM File#

To install an RPM file you’ve downloaded locally (instead of from a repo), use localinstall:

yum localinstall /path/to/package.rpm  

Yum will still resolve and install dependencies from configured repos.

4. Reinstall a Package#

If a package’s files are corrupted, reinstall it with:

yum reinstall <package-name>  

5. Install Package Groups#

Yum supports "package groups" (collections of related packages, e.g., "Web Server" or "Development Tools"). List groups with:

yum grouplist  

Install a group:

yum groupinstall "Web Server"  

6. Install Without Confirmation#

To skip the "Is this ok [y/N]?" prompt, use -y (or --assumeyes):

yum -y install nginx  

Advanced Yum Options for Power Users#

For complex workflows (e.g., offline installs, chroot environments, or debugging), Yum provides advanced flags.

1. Download Packages Without Installing#

Use --downloadonly to save RPMs to your system (e.g., for offline installs). Specify a directory with --downloaddir:

yum install --downloadonly --downloaddir=/tmp/nginx-rpms nginx  

2. Install to a Chroot Environment#

Use --installroot to install packages to a non-default root directory (e.g., for setting up a chroot or a new OS instance):

yum install --installroot=/mnt/new-os nginx  

3. Enable/Disable Repositories Temporarily#

Override repo settings in /etc/yum.repos.d/ with --enablerepo or --disablerepo:

# Install from the EPEL repo (even if disabled in .repo files)  
yum --enablerepo=epel install htop  
 
# Disable the "base" repo temporarily  
yum --disablerepo=base install my-package  

To bypass GPG verification (e.g., for untrusted local packages), use --nogpgcheck. Warning: This exposes you to security risks!

yum --nogpgcheck localinstall /path/to/untrusted.rpm  

5. Clean Yum Cache#

Over time, cached files can cause conflicts. Clear the cache with:

# Clear all cached packages and metadata  
yum clean all  
 
# Clear only cached packages (keep metadata)  
yum clean packages  

Troubleshooting Yum Installations#

Common issues include missing dependencies, repo errors, or corrupted caches. Here’s how to fix them:

1. Missing Dependencies#

If Yum complains about "unresolved dependencies," try:

# Skip broken dependencies (use cautiously!)  
yum install --skip-broken <package>  
 
# Check for conflicting packages  
yum check  

2. Repository Errors#

If Yum can’t connect to a repo, verify:

  • The repo’s baseurl or mirrorlist in /etc/yum.repos.d/ is valid.
  • Your network has access to the repo (e.g., no firewall blocks).
  • Clear the repo metadata cache:
    yum clean metadata  

3. GPG Key Errors#

If you see "GPG key retrieval failed," import the key manually:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  # For CentOS 7  

Conclusion#

Yum simplifies RPM package management by automating dependency resolution and repo management. Packages install to standardized system directories (e.g., /usr/bin/, /etc/), and you can verify paths with rpm -ql.

Key takeaways:

  • Use yum install for basic installs, localinstall for local RPMs, and groupinstall for package groups.
  • Customize behavior with /etc/yum.conf and /etc/yum.repos.d/.
  • Advanced options like --downloadonly and --installroot handle specialized workflows.
  • Troubleshoot with yum clean, --skip-broken, or repo overrides.

With these tools, you’ll master Yum and keep your system’s packages organized and up-to-date.

References#