/usr/local or /opt?

How do you generally proceed for your package installations on Linux, for packages that are not part of your distrib's repos?

On my side I am used to install in /opt. But since, I saw this doc on the Internet: http://www.pathname.com/fhs/. Now I am confused: apparently /usr/local would be also a possibility.

What is the difference between both? Any best practices to share?

Thanks

SirFabel


Solution 1:

  • Everything that has to be compiled & installed Unix-style and complies to FHS -> /usr/local
  • Everything else (e.g. a java web-application that comes with it's own applicationserver and loads of resources in a zip archive -> /opt

Solution 2:

Just as additional interesting info: The original meaning of /usr/local is that if /usr is network-mounted (single /usr shared across multiple computers), /usr/local would be a separate filesystem local to the computer (partition on local disk).

And while on that topic, even if it's off-topic to the question: If there are multiple computers with different architectures, naturally there would be one /usr for each arch, but /usr/share would be yet another separate filesystem shared between architectures (hence 'share').