To do if for all users/shells, depending on distro you could use
/etc/profile. Creating a new file in
/etc/profile.d may be preferable if it exists, as it will be less likely to conflict with updates made by the packaging system.
/etc/environment, variables are usually set with
/etc/profile, you must use
export since this is a script, eg:
Same goes for a file under
/etc/profile.d, there also may be naming restrictions which must be met for the file to work. On Debian, the file must have the extension
.sh (although does not need a bang line or executable permissions since it is sourced). check your distro documentation or look at the
/etc/profile script to see how these files are loaded.
Note also though that setting
LD_LIBRARY_PATH permanently is potentially problematic, including being a security risk. As an alternative, I would suggest finding some way to prepend the
LD_LIBRARY_PATH to the start of the command line for each program that needs it before running. Eg:
One way to do this is to use a wrapper script to run the program. You could give this the same name as your program and put it in
/usr/local/bin or anywhere that appears before the location of your program in
PATH. Here is an example script (don't forget to
chmod +x the script):
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib /real/location/of/myprog "$@"