Building a source RPM using rpmbuild command

Q. I need to build a source RPM, how do I build it?

ADVERTISEMENTS

A. In order to build a source RPM you need to use rpmbuild command. rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

You need to use .spec file to build the RPM file. Next type rpmbuild command as follows:

# rpmbuild -ba pakagename.spec

For more information, please refer Maximum RPM book.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
4 comments… add one
  • Yogesh Feb 28, 2010 @ 13:33

    Whr do I find spec file?

    • Frederik Mar 6, 2011 @ 16:28

      You have to make it yourself (or get someone else to make it for you).

  • Jaire Aug 2, 2012 @ 10:54

    If you have the .src.rpm file, just rpm -ivh .src.rpm. You’ll find the spec file in /usr/src/packages/SPEC directory after instalation.

  • judovana Aug 20, 2014 @ 16:12

    The answer is incorrect.

    Once you have all sources and spec, (in rpmbuild/{SOURCES,SPEC} directories

    the rpmbuild -bs is what you seek.
    see: http://linux.die.net/man/8/rpmbuild

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.