Quantcast
Channel: Linux – Computing
Viewing all articles
Browse latest Browse all 10

Rebuild source rpm to binary rpm on RedHat system

$
0
0

Rebuild source rpm to binary rpm on RedHat system

RPM Build Environment

  • You need to have rpm build and software development environment.
  • Install rpm-build package:

#yum install rpm-build

  • Install software development group:

#yum groupinstall "Development Tools"

  • And install any required library and dependency by a software package that you are going to rebuild.

Directory Structure

  • RedHat and its clones such as CentOS, Fedora, Scientific Linux, WBEL, etc.. have this kind of rpmbuild environment or directory structure.

Top Level

/usr/src/redhat

Secondary Level

/BUILD
/RPMS
/SOURCES
/SPECS
/SRPMS

Third Level

/RPMS/athlon
/RPMS/i386
/RPMS/i486
/RPMS/i586
/RPMS/i686
/RPMS/noarch

  • To rewrite in flat view, for example: /usr/src/redhat/RPMS/i386 and so on.

Getting *.src.rpm and rebuild

  • Download source rpm (usually name as package-name.src.rpm) from your software vendor website.
  • Usually the steps are as follow:

cd /usr/src/redhat/SRPMS/
wget http://www.softwarevendors.org/download/package-name.src.rpm
rpm -Uvh package-name.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba package-name.spec

  • It will rebuild the source rpm to binary rpm. During this building process, the /var/tmp/ will be used for temporary storing for intermediate files. If the rebuild process is success, no files should be left under /var/tmp with trailing name like this pattern somename-tmp.number.

Install/Uninstall rpm

  • If rebuild success, you can install the binary rpm as follow.

cd /usr/src/redhat/RPMS/i386/
rpm -Uvh package-name.rpm

  • Use U switch which over i because you might already have previous version of the same software installed. U for upgrade and i for install.
  • If you want to uninstall:

rpm -e package-name.rpm

  • For more rpm commands:

rpm --help

Cleaning Sources and Workspace

  • If everything is ok, we need to clean up sources and files created during rebuilding process.

cd /usr/src/redhat/SPECS/
rpmbuild --clean --rmsource package-name.spec


Viewing all articles
Browse latest Browse all 10

Trending Articles