I want to export LD_LIBRARY_PATH to system services and all users. System services are run before login, so .bashrc is not applicable. How to achieve this?
You don't need to. Add the directory to
After that, you must run (at least on Redhat)
As a word of caution, you need to be careful which libraries you add to the system shared library path (via the environment, ld.so.conf, or putting in /usr/local/lib). In particular, you beware of two different versions of the same library with the same soname. E.g., if you have a libfoo.0.1 (soname libfoo.0) installed via dpkg/rpm/etc., you don't want a libfoo.0.2 (also soname libfoo.0) in your custom library directory.
(It's actually not that easy to pull off a system-wide environment variable. You can get most user logins with
You can add every path in the file in
Then load them.