How To Build Rpm

Home » CentOS » How To Build Rpm
CentOS 6 Comments

Hi,

For software development, projects are built through makefile. After building, I can run binary program. rpm is more convenient. Is there some tool that can build rpm?

Thanks!

Regards

Andrew

6 thoughts on - How To Build Rpm

  • There are numerous articles that can be found through google that describe the process.

    I personally find it easiest to find a rpm with a structure that’s similar to what I want to create, and use that spec file as a pattern.

    You will want to install rpmdevtools on your computer so you can build and test rpms as a user instead of root.

  • Hi Andrew, if you are expecting a program or tool that can automatically create an RPM for you then no but if you understand processes like
    ./configure, make and make install then in a lot of cases creating your own rpms is reasonably easy. As a start check out things like rpmbuild and mock https://wiki.CentOS.org/HowTos/SetupRpmBuildEnvironment

    It can also be useful to check out source RPMS to see how other rpms have been created. https://wiki.CentOS.org/HowTos/SetupRpmBuildEnvironment

  • You need to learn how to write a spec file, as another person suggested, grabbign one from a similar rpm to use as a template makes this much easier.

    Other than that I highly recommend mock, which you can get from the EPEL
    repository. Google for “fedora mock” for more info about mock.

    Peter

  • Rather than googling for articles, which unless you have the experience already to filter the chaff from the wheat, here’s a link the an article I
    wrote a little while back.

    https://www.hogarthuk.com/?q=node/11

    It’ll take you through building a minimal package, fedora guidelines (which even for personal/internal stuff can help keep clean easier to maintain spec files), usage of mock for clean builds and repo creation.