3

I've been scratching my head over the File System Hierarchy Standard recently and in numerous occasion, when talking about the /usr/local directory, I came across the term "locally installed packages". Could someone please explain what is exactly meant by "local" in this context?

4

A locally installed package under /usr/local, or /opt per the FHS standard, means packages not installed by the default distribution, but packages installed specifically for that system.

The directories /opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib, and /opt/man are reserved for local system administrator use. Packages may provide "front-end" files intended to be placed in (by linking or copying) these reserved directories by the local system administrator, but must function normally in the absence of these reserved directories.

Programs to be invoked by users must be located in the directory /opt/<package>/bin or under the /opt/ hierarchy. If the package includes UNIX manual pages, they must be located in /opt/<package>/share/man or under the /opt/ hierarchy, and the same substructure as /usr/share/man must be used.

Package files that are variable (change in normal operation) must be installed in /var/opt. See the section on /var/opt for more information.

Host-specific configuration files must be installed in /etc/opt. See the section on /etc for more information.

No other package files may exist outside the /opt, /var/opt, and /etc/opt hierarchies except for those package files that must reside in specific locations within the filesystem tree in order to function properly. For example, device lock files must be placed in /var/lock and devices must be located in /dev.

The packages in question can be installed either by the sysadmin, or given the appropriates rights, by other users.

Often they are compiled locally or scripts, however it is possible also to deploy binaries/packages for a specific group of servers, or if installed by the sysadmin, can be compiled and packaged according to the distribution standard (e.g. deb in Debian - I do have local repos).

  • In the Linux world, packages installed from a distribution repository using a package maintainer, although "locally installed" are usually not considered "locally installed software", and does not go into /usr/local. (Insert rant about Linux systems not having a base system in the same way as the BSDs have). – Kusalananda Oct 1 '17 at 7:19
  • @Kusalananda If packages break rules, it is not Linux fault, but indeed, I have seen (many) local packages out of place. I had forgot about /opt – Rui F Ribeiro Oct 1 '17 at 7:43
2

It means different things to different Unices.

The FHS says nothing about "packages" in relation to /usr/local but instead describes it as a "tertiary hierarchy for local data, specific to this host".

  • On most Linuxes, this means that a local administrator may install locally compiled software, or software that comes from other sources than the Linux distribution in use, into /usr/local. The distribution's package manager will not use /usr/local.

    Packages installed from a package repository is not considered "specific to this host".

  • On BSD systems, in contrast, it means that software installed with the operating system's package manager will be installed under /usr/local (except in the case of NetBSD which uses /usr/pkg). BSD systems considers locally installed software to include 3rd party packages installed by a local administrator, even though they may be installed with the system's package manager. Locally compiled software (in the Linux sense) should probably be installed elsewhere, for example under /srv or /opt, as to not accidentally clash with maintained software in /usr/local.

    Packages installed from a package repository is considered "specific to this host".

  • Indeed about the packages coming from official repos, however nothing prevents you doing you own/local ones, and I have got a couple here. It was meant to stress out nowadays the definition of local packages, with the devops movement, may no longer means deployed just for that server. – Rui F Ribeiro Oct 1 '17 at 9:52

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.