6

We have some data import tools we've written in-house and I need to set them up on a new Linux box.

These are written in both Java and .NET (running on Mono) and they comprise binaries, config files, resources/assets like images and templates. They also write logs and look to some special folders for the data to import.

I'm new to Linux. At the moment, they're in a folder like /data/importer.java/ and /data/importManager.net/ with these folders containing everything they need to run.

But I see /data/ is a non-standard folder. So I wanted to know if there's a proper place to set them up, however it seems the on Linux, there's many, many folders each for a specific purpose and for read-only/read-write data.

Its almost as if I need to split my apps over a bunch of folders to do it properly, and some folder names, like bin sound right but then what do I with non-binary/compiled files?

Aside from the binaries, the config and everything else is often modified by humans.

Something like (just focusing on the Java part for now):

  • /opt/importer.java/ for the binaries, config and resources
  • /var/importer.java/data-in/ for dropping in data to import
  • /var/importer.java/logs for the logs written

Or maybe I should use the /srv/ folder? Or perhaps /usr/bin/. Maybe logs should be written to the /home/ folder of the running user?

It's all so complicated. Whenever I read any Linux documentation I regret it. Should I just copy it all over from the other machine as-is and forget I ever tried?

Thanks

Luke

  • 1
    What you're doing there looks pretty fine to me. Choice between putting the data into /var is especially good as that just makes sense in my humble opinion. Having the application specific folders, be that under /opt or /var is a good option as well. I'd put binaries into /opt/<myapp>/bin and then let users place that in their $PATH or create symlinks to /usr/local/bin or whatever they wish. – Sami Laine Mar 13 '14 at 17:29
  • Review the FHS, it is the closest we have to a standard. pathname.com/fhs – Zoredache Mar 13 '14 at 17:35
13

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".

  • That'll do for me. I have seen other talk of using /opt/company-name/app-name – Luke Puplett Mar 14 '14 at 21:30
  • Is it ok with folder /var . I see usual etc/local/ ... I i wanna use already shared location? I mean node.js app and similar... Is it /var safe place for server code? – Nikola Lukic Feb 26 at 21:16
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.