Where should I install my app on Linux?

This is a question with no right answer and an intriguing bit of Unix history.

The rule we followed at my prior employer was that non-out-of-the-box software was installed in /opt/PackageName-VersionNumber and there was a symbolic link from /opt/PackageName-VersionNumber to /opt/PackageName.

Configs go in /opt/PackageName/etc
Logs go in /opt/PackageName/logs
Binaries go in /opt/PackageName/bin
Data goes in /opt/PackageName/data

For apps that were to be distributed outside of our shop we wrote them to be relocatable by the package manager. This was a rare occurrence, and not "fun".


As far as I'm aware native linux applications are written to have their binaries in [/usr]/bin, logs in /var, config in /etc, and so on. Non native applications or combinations of packages (such as lampp/xampp for example) that are meant to be used systemwide, on the other hand are by default installed in /opt, with the configuration usually also residing in that folder. If the software is meant to run per user a folder inside their home directory is customary.

Tags:

Linux

Centos