To create an RPM package, you must complete the following steps:
. Create a directory to store the package. Within the package directory, create a `.spec` file.
. In the `.spec` file, add information about your software, instructions for unpacking it, building it, and installing it, as well as a list of files that are in the package.
. Run the `fedpkg` command with the appropriate options to build your package.
. To create a directory, add a package, and within the package, create a simple program, enter the following commands:
NOTE: The directory `packaging-work`, the package `howdy`, and program `howdy` names are for example purposes. Edit these names to suit your project. You can use any location you want but the directory name for the package should match the name of the package.
. Create a new file `howdy.spec` and open `howdy.spec` in your text editor. Populate the `howdy.spec` file using the following example as a guide but change anything you require:
. To instruct the package how to install the program, add thie following information to the `%install` section of the `.spec` file. Add the information to the line that follows `%install`:
NOTE: In this example, we use the following three macros: `%{buildroot}`, `%{_bindir}`, and `%{SOURCE0}`. This method ignores the origin of the files and directories and focuses on the destination of the files. Without `%{buildroot}` the files might install directly onto your development machine. This is not recommended, especially if you run as root. For more information on macros and `.spec` file entries, see xref:con_rpm_spec_file_overview[].
NOTE: In general, the `%files` section is about files you have installed into the buildroot. You do not use the `%{buildroot}` macro when listing files there.
In this example, the package is a shell script, and there is no requirement for the package to build separately on every architecture that Fedora supports.
. To specify that this package is independent of architectures, open the file in your text editor and add the following information after the `Source0:` line:
This command is more important when your RPM package gains complexity and has dependencies.
For more information about building a more complete and complex RPM package, see https://fedoraproject.org/wiki/How_to_create_a_GNU_Hello_RPM_package[How to create a GNU Hello RPM package].