Where Does Yum Install Packages and What Are the Options?

YUM (Yellowdog Updater Modified) is a package management tool used in Linux distributions like Red Hat, CentOS, and Fedora to manage software installations, updates, and removals. Understanding where YUM installs packages and how to configure or control its behavior can help you manage your system’s software more effectively.

YUM works by downloading and installing packages from repositories defined in your system’s configuration. These repositories contain precompiled packages and their dependencies, making it easier to maintain a system without manually resolving dependencies. When you install a package using YUM, the package files are stored in specific directories depending on the package type and linux file system structure.

In this tutorial you will learn:

  • Where YUM installs packages on a typical Linux system
  • How to configure YUM to use specific directories
  • Common commands and options to manage package installations
Where Does Yum Install Packages and What Are the Options?
Where Does Yum Install Packages and What Are the Options?
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat, CentOS, Fedora, or other YUM-based Linux distributions
Software YUM package manager version 3.x or higher
Other Basic knowledge of Linux file system structure
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Where Does YUM Install Packages?

YUM installs packages to various directories based on the package type and how the system is configured. The primary locations include:

  • /bin: Essential command binaries (like basic shell commands) are stored here, required for the system to operate even if no other file systems are mounted
  • /usr/bin: Most executable binaries are installed here
  • /etc: Configuration files for software packages
  • /usr/lib or /usr/lib64: Libraries for installed packages
  • /var/log: Log files generated by applications

The installation locations are generally determined by the package maintainer when the RPM is created, so they vary by package. However, you can control where packages are downloaded or cached by configuring YUM’s settings.

Aside from the main directories where YUM installs packages, there are several others that may play a role. The /var/cache/yum directory stores cached package downloads temporarily before installation. The /usr/share directory contains architecture-independent files, such as documentation, shared libraries, and icons for installed packages. The /lib or /lib64 directories store essential shared libraries required by programs in /bin and /sbin. Additionally, /usr/local may be used for locally compiled software, which could include custom installations outside of YUM-managed packages.

Common YUM Configuration Options

YUM uses configuration files located in /etc/yum.conf and /etc/yum.repos.d/. These files allow you to modify the default behavior of YUM, such as where it downloads packages or whether it keeps cached packages. The keepcache option, for instance, controls whether YUM keeps packages in the cache after installation.

  1. Viewing Package Installation Directory: To find out where a package is installed, use the following command to query the package’s files.
    $ rpm -ql package_name

    This command will list all files installed by the package along with their locations. For example, running rpm -ql httpd will show the location of Apache’s installed files.

    Viewing Package Installation Directory with RPM command
    Viewing Package Installation Directory with RPM command


  2. Enabling Package Caching: By default, YUM removes downloaded packages from the cache after installation. To retain these packages, you can modify the yum.conf file.
    # vi /etc/yum.conf

    In the configuration file, set keepcache=1 to retain the packages after installation. This is useful if you want to reinstall packages without redownloading them.

  3. Customizing Package Download Directory: YUM stores temporary files in the /var/cache/yum/ directory by default. You can modify this location by editing the cachedir option in yum.conf.
    # vi /etc/yum.conf

    Change the cachedir path to your desired directory, such as /home/user/yum-cache.

Conclusion

YUM is a versatile tool for managing software on YUM-based Linux distributions. By understanding where packages are installed and how to configure the package manager, you can better control your system’s software environment. Whether you are querying package locations, configuring the cache, or setting custom download directories, YUM provides the flexibility needed for system administrators and developers alike.