Wednesday, November 24, 2010

Best of both worlds. Modifying source/configure options for rpms

RPM's are great. They let you keep track of what's installed, dependencies and manages the removal of packages. In 99% of cases the RPM works great. In 1% of cases you may run across a bug in the package where the widely accepted solution is to remove or add an extra compile flag to fix the issue.




  1. Stop any services using the rpm

  2. Uninstall the rpm

  3. Install the rpm but do not confirm.
    In the rpm output before the confirm it will tell you which repo the package is at.

  4. Read the baseurl from the appropriate repo config file in /etc/yum.repos.d

  5. Create a tmp/working directory

  6. Go to that baseurl and use wget to get the somepkg.src.rpm package

  7. rpm -i /path/to/src.rpm

  8. cd /usr/src/redhat/

  9. To edit config flags, modify /usr/src/redhat/SPECS/somepkg.spec

  10. Rebuild the rpm ( rpmbuild -bb /usr/src/redhat/SPECS/somepkg.spec) (You may need to install some *devel packages)

  11. The RPM will be located in /usr/src/redhat/RPMS/{arch} .. where {arch} is the architecture for your machine (usually i386)