Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 2 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
    
This answer has an error. Both lines need export before them. Thanks. –  unixman83 Mar 24 '12 at 13:50
    
Ah, sorry, updating. –  cjc Mar 24 '12 at 13:51

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

/usr/local/lib

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

share|improve this answer
3  
+1: imho this is a much cleaner solution than the accepted one. –  Blizz Oct 20 '12 at 12:53
    
Dare I call this method "proper"? –  Tim Oct 29 '13 at 16:50
    
I tried to edit and correct the misspelling of directory name (add the ".d") to make it "/etc/ld.so.conf.d/" but stackexchange prevents it with "Edits must be at least 6 characters;" and the Save hangs. –  JasDev Feb 1 at 11:48

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.