Fixing error: rpmdb: damaged header instance on CentOS

While trying to install a new package using yum I received the following error error: rpmdb: damaged header #929 retrieved -- skipping.

To fix this, I went to the /var/lib/rpm directory and removed all the lock files (there were 4)

$ sudo rm __db*

I then rebuilt the database

$ rpm --rebuilddb

I then ran the following command

$ sudo yum clean all

After restarting the machine I was able to install the package without trouble.

more yum posts

more CentOS posts