Rebuild source rpm to binary rpm on RedHat system

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:

  • Install software development group:

  • 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

Secondary Level

Third Level

  • 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:

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

  • 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:

  • For more rpm commands:

Cleaning Sources and Workspace

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