Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I'm building and installing some third-party software called foo. I want headers in /usr/local/include/foo, shareable read-only data in /usr/local/share/foo, and so on. But let's say foo insists on being difficult and wants me to pick a directory PREFIX and install stuff in ${PREFIX}/include and ${PREFIX}/share and so on. If I choose PREFIX=/usr/local then it might clobber some existing files in /usr/local/include, /usr/local/share, and so on. Are there best practices for where PREFIX should be?

share|improve this question
There is always the FSH. – Iain May 15 '13 at 6:43
up vote 5 down vote accepted

That is what /opt is for. Make a directory inside /opt for the self-contained software package. You'll have to add /opt/*/bin to your PATH manually.

share|improve this answer
What exactly are "add-on application software packages"? If, hypothetically, foo were the main server daemon running on my machine, would it still be appropriate to install it in /opt/foo, just because it breaks the rules? – Brian Bi May 15 '13 at 3:20
"Add-on" means software that is provided by someone other than the operating system vendor. Yes, your hypothetical example shows exactly how /opt is meant to be used. Software that installs into /opt is a bit rare in the Linux community, since your distro's package manager does a fine job of managing files throughout the filesystem hierarchy. However, it's not wrong, and is in fact quite common practice with Unix flavors that don't have such capable package managers as Linux. – 200_success May 15 '13 at 3:34
Fair enough, then. – Brian Bi May 15 '13 at 3:35
/opt/$VENDOR/$PACKAGE/$VERSION/<pseudoroot filesystem> seems to be a pretty good way to do it. – Tom O'Connor May 15 '13 at 8:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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