/opt:
/opt is for “the installation of add-on application software packages”.
/usr/local :
/usr/local is “for use by the system administrator when installing software locally”.
[ad type=”banner”]difference between /opt and /usr/local
- The basic difference is that /usr/local is for software not managed by the system packager, but still following the standard unix deployment rules.
- That’s why you have /usr/local/bin, /usr/local/sbin /usr/local/include etc…
- /opt is for software that doesn’t follow this and is deployed in a monolithic fashion. This usually includes commercial and/or cross-platform software that is packaged in the “Windows” style.
- /usr/local/ usually contains a bin, sbin, lib, and so forth, so works for small scripts, libraries, and the like while /opt/ tends to accumulate applications that’ve grown large enough to accumulate their own directory tree.
- /usr/local, for self, inhouse, compiled and maintained software. /opt is for non-self, external, prepackaged binary/application bundle installation area.
- /opt is for third-party applications that don’t rely on any dependencies outside the scope of said package. /usr/local is for packages installed on this machine outside the scope of the distribution package manager.
An example:
- An open source sip-client supplied as a .deb would install into /usr. If it was built with the Qt framework, apt would pull it in as a dependency.
- The same open source sip-client built from source would reside in /usr/local so it would not be messed up by apt if you later installed a .deb package for the same application. You could either build its dependencies from source, or get them from the package manager.
- A third-party application in /opt is supposed to be self-contained. For instance, a proprietary sip-client using Qt would not rely on the version from apt, but would have it bundled or statically linked in.