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
-
Create a
tararchive of your application source code:console tar -cvf my-app.tar.gz my-appIn this example, your application source code is in a directory named
my-app. -
Move the
.tararchive of your software to therpmbuild/SOURCESdirectory:console mv my-app.tar.gz rpmbuild/SOURCES/ -
Create a
specfile for a new RPM package calledmy-app:console rpmdev-newspec my-appThis command creates a spec file for your
my-appapplication in~/rpmbuild/SPECS/my-app.spec. -
Modify the
~/rpmbuild/SPECS/my-app.specfile with a text editor. For more information about spec files and how to customize them, see the RPM packaging Guide on GitHub. -
Build the binary RPM package:
console rpmbuild -ba ~/rpmbuild/SPECS/my-app.spec -
Create a directory for your RPM package repository, move your
.rpmfile 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