Linux : How to install source rpm on RHEL/CentOS

By | December 9, 2012

Here is a quick tutorial regarding how to install a source RPM on RHEL/CentOS Linux.

1. Prepare the build environment and get the dependencies. Do those following command under your root home directory :

yum install rpm-build redhat-rpm-config gcc make
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

2. Put the source rpm file at the root of your home directory and then run this command to rebuild the rpm under your system :

rpmbuild --rebuild <package-0.0-0.src.rpm>

(*replace <package-0.0-0.src.rpm> including ‘< >’ with your package name. you can put the source package under /rpmbuild/SOURCES as well to archive it.)

3. Install the RPM :

cd /rpmbuild/RPMS
rpm -i <package-0.0-0.x86_64.rpm>

NOTE : Your package might be under another containing directory such as i386, x86_64 or noarch depending of the architecture.