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?
Asked
Active
Viewed 8.3k times
2 Answers
93
You can edit the file /etc/ld.so.conf
and add your path /usr/local/lib
to it
or create a new file in /etc/ld.so.conf.d/
like /etc/ld.so.conf.d/usrlocal.conf
and put only the following line in it
/usr/local/lib
Then run ldconfig -v
as root, and you're done.
![](../../users/profiles/507540.webp)
BitGen01100000
- 157
- 8
![](../../users/profiles/100122.webp)
Olivier S
- 2,719
- 1
- 12
- 14
-
10+1: imho this is a much cleaner solution than the accepted one. – Blizz Oct 20 '12 at 12:53
-
5Dare I call this method "proper"? – Tim Oct 29 '13 at 16:50
-
I had to run this as root (via sudo) – Code Abominator May 18 '18 at 05:07
-
1Is this what you meant to say: "you can edit /etc/ld.so.conf and /usr/local/lib" ? – ThomasMcLeod Jun 26 '18 at 20:00
-
1But after doing this I am getting error `/usr/lib64/python2.6/site-packages/pycurl.so: undefined symbol: CRYPTO_set_locking_callback` while using yum. What to do? – erTugRul Aug 29 '19 at 11:25
-
This doesn't work for me (CentOS 6). Library file still not found. – MiloDC Jan 23 '20 at 21:46
11
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
![](../../users/profiles/90299.webp)
cjc
- 24,533
- 2
- 49
- 69
-
6While this works, for a proper installation, see @Olivier S's answer below. – csl Apr 21 '16 at 12:00
-
2Also, OP probably wanted `$PATH` to refer to `/usr/local/bin` instead of `/usr/local/lib`. I agree that's not the original question, but custom software is standardly installed in `/usr/local` prefix with binaries in `/usr/local/bin`, libraries in `/usr/local/lib`, etc. – chutz Aug 22 '17 at 08:18