Install src.rpm package on Red hat Linux

2

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

Kumar

Posted 2010-04-06T12:34:49.387

Reputation: 373

Answers

5

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:

rpm/SOURCES
rpm/SPECS

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

rpm/BUILD
rpm/RPMS
rpm/RPMS/i386
rpm/RPMS/i686
...

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: How to unpack and rebuild RPM packages on Fedora?

Philippe A.

Posted 2010-04-06T12:34:49.387

Reputation: 222

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 – 2010-07-28T15:35:56.377

2

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).

Ignacio Vazquez-Abrams

Posted 2010-04-06T12:34:49.387

Reputation: 100 516

@Ignacio Vazquez-Abram, I am getting error "bash: mock: command not found" – Kumar – 2010-04-06T12:42:47.670

Feel free to install it first, with yum. – Ignacio Vazquez-Abrams – 2010-04-06T13:03:24.157

1

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

Redhat RPM Source Packages

bgarlock

Posted 2010-04-06T12:34:49.387

Reputation: 31

2Can this be summarised here? – bertieb – 2015-09-29T20:38:08.910