I used a following commmand in SSH terminal on my server:
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/liband it works fine: my program finds all libraries at this point (if I launch it from my SSH command line).
A command
envshows that LD_LIBRARY_PATH is set properly.
But! When I close my SSH client and reconnect again there is no LD_LIBRARY_PATH set any more.
How to set environment variables constantly on my server under CentOS? Thanks.
12 Answers
As mentioned in your own answer and the one given by @Fegnoid, exporting the variables in a .sh file inside /etc/profile.d/ or in ~/.bash_profile would do the trick. Keep in mind that if you intend to use these environment variables in a service script, it might not work as you expect since service purges all environment variables except a few.
See .
Export the variables in the ~/.profile or ~/.bash_profile of the user to have them set on login so the line would be
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH 4