2

The /opt/ directory in Linux is used for installing add on packages.

What is the difference between the /opt/<package>/bin directory and the /opt/<package>/X/bin directory? What is the difference between placing the binary in these directories?

Could you also please point me to some documentation which explains what the directory structure should be for a new software package/application installed in the /opt/ directory?

  • 1
    Wait, was @Stephen Kitt's edit what you actually meant? You seemed previously to be asking about /opt/bin (which I've seen) vs. /opt/package/bin, but now it looks like you're asking about /opt/package/X/bin, which I haven't seen in any package... – Bandrami Apr 23 '15 at 5:23
  • @Bandrami, my edit just revealed what @arun had typed originally; the <package> portions of the paths were interpreted as HTML tags. So the original input, /opt/<package>/bin, appeared as /opt//bin, and /opt/<package>/X/bin appeared as /opt//X/bin. – Stephen Kitt Apr 23 '15 at 5:25
4

Per FHS, /opt/bin, /opt/lib, /opt/info, /opt/include, /opt/doc, and /opt/man are there for the administrator's convenience. For instance, you might have /opt/jdk and /opt/LibreOffice holding your jdk and office suite, but rather than add a new element to $PATH, ld.so.conf, etc. every time you add another package, you can just symlink the binaries to /opt/bin, the libs to /opt/lib, etc.

Basically, you should put the binary in /opt/foo/bin and, at your discretion, symlink the binary into /opt/bin

FHS does not specify any particular organization within /opt/package, but the widely accepted practice is to make a bin and lib directory, and possibly doc, man, etc. as needed.

As a side note: if you are writing to /opt/foo FHS also clears you to write to /etc/opt/foo and /var/opt/foo.

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.