16

I can't decipher the deciding factor on where to place "variable program data" for an /opt installed package. On one hand the FHS says to place all variable data that dictates a program's state into /var/lib and that this data should stick around after a reboot. It also says this data is host specific. Now the FHS also says that the /var/opt directory should house opt "variable data". So.. lets just say I have installed a package and I have the option of setting its "working directory (this is how the package names this path)". Where should I put it?

For reference See:

http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION http://www.pathname.com/fhs/pub/fhs-2.3.html#VAROPTVARIABLEDATAFOROPT

Note that this question naturally extends to /usr/local variable data as well.

fthinker
  • 316
  • 1
  • 3
  • 9

2 Answers2

15

If you want to strictly follow the FHS, then /var/opt/<appname> for the data of apps installed in /opt is the right place to go. Stuff installed in /usr/local typically just used /var/lib/<appname>.

Of course, in practice I think there is little difference unless you have some overlap between your opt/local apps and the ones that come packaged with your distro. I tend to just put everything in to /var/lib since that's the first place myself or anyone would look. Most people are not familiar with or not expecting to find things in /var/opt

Kamil Kisiel
  • 11,946
  • 7
  • 46
  • 68
  • 2
    Don't forget that there is a /var/local directory for storing what would be in /var/opt. So imo this question still remains open unless the answer is that it is just a matter of opinion :) – fthinker Apr 21 '11 at 04:24
  • 4
    Well, the FHS is a standard created mostly for use by distributions. As a user you are free to put your data wherever you want. IMO it *is* mostly a matter of opinion. Personally I've never put data anywhere other than `/var/lib` for the reasons I've stated above. Unless you're planning to distribute software you expect to be installed on FHS systems, I think it's mostly a non-issue and more of a matter of site policy than anything else. – Kamil Kisiel Apr 21 '11 at 04:56
2

The difference between /var/opt and /var/lib (or similarly between /opt and /lib) is usually whether any particular package comes from the standard OS repository or manually downloaded and installed/compiled by the administrator. Again usually what ends up in opt folders is purchased non-free programs and 3rd party software not installed by the OS package manager. Those programs and software usually have their own way of self-management, e.g. satisfying library dependencies, un-installation, etc.

oᴉɹǝɥɔ
  • 151
  • 6