VOOZH about

URL: https://linuxconfig.org/how-to-remove-orphaned-packages-on-centos-linux

⇱ Remove Orphaned Packages on CentOS


Skip to content

Removing unused or orphaned packages from your CentOS Linux system can help free up disk space, improve system performance, and reduce potential security vulnerabilities. Orphaned packages are those that were installed as dependencies for other software but are no longer needed because the original software has been removed. This guide will walk you through the steps to identify and remove these orphaned packages effectively.

In this tutorial you will learn:

  • How to identify orphaned packages on CentOS
  • How to remove orphaned packages using command-line tools
πŸ‘ How to Remove Unused Packages on CentOS Linux
How to Remove Unused Packages on CentOS Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System CentOS Linux 7 or 8
Software Yum package manager
Other Access to terminal or command line interface
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

Understanding Orphaned Packages on CentOS

Orphaned packages are essentially unnecessary software remnants that linger on your system after the primary software they were associated with has been uninstalled. These packages can clutter your system and consume valuable resources. Identifying and removing them can streamline your system operations and maintenance.

  1. Install yum-utils: To identify orphaned packages on CentOS, you need the package-cleanup tool, which is part of the yum-utils package. First, ensure yum-utils is installed:
    # yum install yum-utils


  2. Identifying Orphaned Packages: Once yum-utils is installed, you can list orphaned packages with the following command:
    # package-cleanup --leaves

    This command will display a list of packages that are not required by any other installed package, indicating that they might be orphaned.

  3. Removing Orphaned Packages: After identifying the orphaned packages, you can remove them using the yum remove command. For example, if package-cleanup --leaves lists package1 and package2 as orphaned, you can remove them with:
    # yum remove package1 package2

    It’s important to review the list of packages to ensure that none of them are needed for other applications or system functionality before proceeding with the removal.

Conclusion

Regularly cleaning up orphaned packages on your CentOS system helps maintain optimal performance and security. By using tools like package-cleanup, you can efficiently manage and remove unnecessary software components, ensuring your system runs smoothly and efficiently.