Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I install custom software in /usr/local/lib. How do I set the PATH and LD_LIBRARY_PATH in CentOS 6 system-wide to use /usr/local/lib. I realize there may be more than one way. What's the simplest and most standard way?

share|improve this question
up vote 5 down vote accepted

You can add it in /etc/bashrc, say, at the end.

export PATH=$PATH:/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
share|improve this answer
    
While this works, for a proper installation, see @Olivier S's answer below. – csl Apr 21 at 12:00

you can edit /etc/ld.so.conf and /usr/local/lib or create a new file /etc/ld.so.conf.d/usrlocal.conf and put only the line

/usr/local/lib

Then run ldconfig -v as root, and you're done.

share|improve this answer
6  
+1: imho this is a much cleaner solution than the accepted one. – Blizz Oct 20 '12 at 12:53
3  
Dare I call this method "proper"? – Tim Oct 29 '13 at 16:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.