What are conventions for installing rpms created by me

I develop an application that has backends (user daily daemons and punctual scripts written in c++ and python) and frontends (Qt GUIs and other clis).
I am looking for filesystem conventions and happy to stick to Fedora only solution.

  1. my rpms would always be installed (ie the files contained in them ) as root? what permissions?
  2. where? presumably out of the “regular” tree (LFS standard)… /opt or /usr/local, how do I choose?
  3. the processes will run with a particular unix user. any link between that and the owner of the files in rpms?
  4. i generate the rpms from cmake
  5. I’ve gone as far as simply preparing the .rpm files and then sending them to the various hosts I want them installed on (all Fedora)… I install with dnf. … I’m not yet interested in using a repo.
    In the future, I would.

Help’s appreciated
Rds,

1 - Usually all the files are installed as root because RPMs generally only write to the root fs and it requires root to invoke the installation of an RPM(either with rpm or dnf). The permissions depend on your specific RPM and how the spec is configured to install the files, generally this is handed by install -m 000 command where 000 can be modified to fit whatever permissions you like(executables and directories usually get 755 and other files such as configurations usually get 644), this command is usually called inside a makefile, inside a spec file, or by a macro inside a spec file.

2 - You can do whatever you like. However, if you’d like to follow some filesystem conventions, then it’s best to install executables to /usr/bin because it’s being installed by an RPM and is thus being managed by a package manager(the rpm package manager if you install from a local file or dnf if you decide to upload and download from a repository). /usr/local is intended for files and executables that are exclusive to your local system and not managed by a package manager, maybe if you wrote a little bash script for yourself then /usr/local/bin would be a “correct” place to put it. /opt is intended for software that you compiled locally, like if you downloaded Firefox’s source code and compiled it then /opt would be a place to put it.

3 - The processes will generally run with the permissions of the user rather than the permissions of the owner of the executable(almost always root).

1 Like

Install owned by root with permissions to read and if required execute.

To avoid any posible conflict with Fedora packages /usr/local is fine.
But you could also use /usr.

Are you installing services? Or just apps that a user runs?

The gold standard is to build your source RPMs using mock so that you know you have all the build dependencies and install dependencies correct.

A repo is easy to make and maintain using the /usr/bin/createrepo tool.