How to remove duplicate packages with yum

I’m working on a handful of servers that all have the same problem: when running yum, an error message appears that tells me a package called ntpupdate needs to be upgraded, but somehow this doesn’t work and the package is being skipped. Then follows a huge list of duplicate packages that are installed on those systems (probably installed by the automatic package updater within Plesk).

Let’s see how we can fix such issues.

The Problem

Here’s the output:

The list goes on. The solution: remove the duplicate packages and start again!

The Solution: Removing duplicate packages

First we need to install something called yum-utils. It’s as easy as this:

Next we’ll display a list of which packages exist more than once on our server. No changes are being made just yet:

To remove the oldest versions of all duplicate packages, we’ll issue the package-cleanup –cleandupes command. The output that follows looks almost identical to that of a yum update command, except that things are being erased rather than updated.

When the process has finished, we can use yum update again without trouble.

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

One thought on “How to remove duplicate packages with yum

Add your voice!