Monday, 14 June 2010

How to build RPMs from source SRPMS

Following are the steps for root installation.

Pre-requisite :

Following are the package to be installed which provides the build enviroment and create neccessary directory.

rpm-buld
rpm-devel

Step 1. rpm -ivh package.src.rpm

Step 2. cd /usr/src/redhat/SPECS

Step 3. rpmbuild -bb filename.spec [ --bb - only rpm ]
[ --ba - create rpm and source rpm]

Above command will compile the source code and generate the rpm in the following directory.

/usr/src/redhat/RPMS/i386

For non-root users , the following are the steps to be followed to build RPM

-----------------------------------------------------------------------------


1. Create the following directory hierarchy under your home directory

rpm
|-- BUILD
|-- RPMS
| `-- i386
|-- SOURCES
|-- SPECS
`-- SRP

2. Set the environment variable

echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

which tells the rpm manager that user wants the above location to build RPM

Then follow the steps1, 2 and 3 in root-installation.

No comments:

Post a Comment