Skip to content

Packaging applications with RPM

Packaging applications with RPM

Use this workflow to package your own application source code into an RPM package. After you package your software, add it to a local RPM repository. RPM Package Manager queries the RPM packages in this repository, resolves their dependencies, and installs them in your operating system (OS) image.

Procedure

  1. Create a tar archive of your application source code:

    console tar -cvf my-app.tar.gz my-app

    In this example, your application source code is in a directory named my-app.

  2. Move the .tar archive of your software to the rpmbuild/SOURCES directory:

    console mv my-app.tar.gz rpmbuild/SOURCES/

  3. Create a spec file for a new RPM package called my-app:

    console rpmdev-newspec my-app

    This command creates a spec file for your my-app application in ~/rpmbuild/SPECS/my-app.spec.

  4. Modify the ~/rpmbuild/SPECS/my-app.spec file with a text editor. For more information about spec files and how to customize them, see the RPM packaging Guide on GitHub.

  5. Build the binary RPM package:

    console rpmbuild -ba ~/rpmbuild/SPECS/my-app.spec

  6. Create a directory for your RPM package repository, move your .rpm file to this directory, and initialize the directory as an RPM package repository:

    console mkdir /var/tmp/my_repo cp -rp ~/rpmbuild/RPMS/* /var/tmp/my_repo/ createrepo /var/tmp/my_repo

Your RPM package repository is now ready, and it contains your software packaged as a .rpm file. When you build the AutoSD image, include the RPM package repository in the build manifest to enable the OS image to incorporate your software. For more information about building the AutoSD image, see Building an AutoSD image.

Next steps