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

How can i install src.rpm package on Red hat Linux ?

share|improve this question
up vote 3 down vote accepted

Installing a src.rpm is very much like unpacking the source code of a program. If you run (as yourself) :

rpm -vv -Uvh package.src.rpm

You will see the source installed under your home under a rpm tree:


You will find a spec file telling how the rpm is built. You will find one or more files needed to build the RPM under the SOURCES directory.

You will also see


The BUILD dir is used when the rpm is rebuilt. The final RPM gets written under the appropriate RPMS subdirectory.

The interest of installing a src.rpm is to modify and rebuild it. But if the source you need already contains spec file to build the rpm, it's better downloading the source and building the rpm from it when you so desire:

rpmbuild --rebuild -bb rpm.spec

You can find more information on rebuilding srpms here:

share|improve this answer
Note that openly building a package like this can taint it with things not specified in the spec file but installed regardless, which is why it's recommended to use a tool such as mock that builds it in a clean environment. – Ignacio Vazquez-Abrams Jul 28 '10 at 15:35

Use mock to rebuild it for your distro/version.

mock --resultdir=some/dir -r distro-version-arch --rebuild somepackage.src.rpm

Then install the resulting binary package(s).

share|improve this answer
@Ignacio Vazquez-Abram, I am getting error "bash: mock: command not found" – Kumar Apr 6 '10 at 12:42
Feel free to install it first, with yum. – Ignacio Vazquez-Abrams Apr 6 '10 at 13:03

Here's a short article I wrote on this, way back when Redhat was at 6.2:

Redhat RPM Source Packages

share|improve this answer
Can this be summarised here? – bertieb Sep 29 '15 at 20:38

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.