What is the difference between /etc and /usr/local/etc

/usr/local is usually for applications built from source. i.e. I install most of my packages using something like apt, but if I download a newer version of something or a piece of software not part of my distribution, I would build it from source and put everything into the `/usr/local' hierarchy.

This allows for separation from the rest of the distribution.

If you're developing a piece of software for others, you should design it so that it can be installed anywhere people want, but it should default to the regular FHS specified system directories when they specify the prefix to be /usr (/etc, /usr/bin, etc.)

i.e. /usr/local is for your personal use, it shouldn't be the only place to install your software.

Have a good read of the FHS, and use the standard Linux tools to allow your source to be built and installed anywhere so that package builders for the various distributions can configure them as required for their distribution, and users can put it into /usr/local if they desire or the regular system directories if they wish.


A very short answer

/etc is used by your OS for its configuration files

/usr/local/etc can be used for your config files by you and your addtionally installed software


/usr/local/etc is rarely used in the Linux world. But the decision whether to store configuration files in /etc, /usr/local/etc or some other location is generally made at compile time (and often can be overridden through a command line option or environment variable). It doesn't really matter what the default is when compiling, just make sure it's easy to set (typically an option to --sysconfdir, following autoconf). If your daemon is packaged for a distribution, the executable will go into /usr/sbin (the default when building from source should be /usr/local/sbin) and the configuration under /etc.

Note that /etc is not the place for “lots of application data”. That goes into /var. The default when building from source could be /var/local/mydaemon or /var/lib/mydaemon; again there's no strong convention either way for the default when building from source. There should be a way to change both the compile-time default (typically with configure --localstatedir) and the run-time default (with a setting in a configuration file, possibly with a command line option or environment variable).