Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux - /usr/local or /var for application data?

Tags:

linux

I'm developing an application that needs to store some data. I'm doubting between storing it in /usr/local/myapp, or in /var/lib/myapp.

Which is the most suitable directory for this?

like image 982
Julen Avatar asked Jun 27 '16 15:06

Julen


People also ask

Where do I put application data in Linux?

A seemingly better place to store your application state data would be /var , or more specifically, /var/lib . This also comes from the Hierarchy Standard. You could create a /var/lib/myapp , or if you're also using things like lock files or logs, you could leverage /var/lock or /var/log .

What is usr local var for?

Variable data for local programs (i.e., programs that have been installed by the system administrator) that are installed in /usr/local (as opposed to a remotely mounted '/var' partition). Note that even locally installed programs should use the other /var directories if they are appropriate, e.g., /var/lock.

What is var used for Linux?

Purpose. /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.

What is etc and var in Linux?

The /etc and /var directories contain system control files. The /etc directory contains customization data that you maintain and the /var directory contains customization data that IBM® maintains.


1 Answers

As /usr is for constant data and /var for variable data, use /var to store these data.

And, concerning /usr/local/: Make sure that packagers can choose to install your software to /usr/lib/ / /usr/share / /usr/bin by providing an appropriate variable in your make file.

Software installed manually (i. e. with make install etc.) should resinde in /usr/local/*, while software packaged via .rpm / .deb / whatever should avoid /usr/local and directly be installed under the appropriate folders in /usr.

like image 123
glglgl Avatar answered Sep 30 '22 06:09

glglgl