Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to extract an installed RPM from an RPM database on RedHat Linux to reproduce the original .rpm file?

share|improve this question

migrated from Jun 27 '11 at 22:13

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

If you want to save a copy of the package as currently installed before upgrading or removing it, use rpm --repackage -- it'll save the RPMs in /var/tmp or /var/spool/repackage or elsewhere, depending on your configuration.

Otherwise, there exists rpmrebuild, which does exactly what you ask for.

Word of caution: with neither of these tools do you obtain the exact same *.rpm as the one you started from. Any changes to the installed files belong to the package will be in the RPMs generated.

share|improve this answer
I believe it's worthwhile to note that rpm --repackage will Re-package the files before erasing I almost ran this command blindly, but looked at the linked docs first. – Kevin Meredith May 31 '13 at 12:25

Producing the original rpm file isn't possible, it's been extracted and possibly discarded. The rpm database has information about what files it's installed and their checksums, permissions, and the postinst scripts\:

# verify package contents
rpm -q packagename --verify
# read the scripts that run on installation and removal
rpm -q packagename --scripts

will give you some information.

If you want to obtain an rpm from the respository, I recommend using yumdownloader, from the yum-utils package.

yum install yum-utils
yumdownloader packagename

This will download the latest rpm, not the one that is installed currently.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.