CentOS /usr/local/lib system wide $LD_LIBRARY_PATH?

82,504

Solution 1

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

Solution 2

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.

Share:
82,504

Related videos on Youtube

unixman83
Author by

unixman83

Updated on September 18, 2022

Comments

  • unixman83
    unixman83 over 1 year

    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?

  • Blizz
    Blizz over 11 years
    +1: imho this is a much cleaner solution than the accepted one.
  • Tim
    Tim over 10 years
    Dare I call this method "proper"?
  • chutz
    chutz over 6 years
    Also, 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.
  • Code Abominator
    Code Abominator almost 6 years
    I had to run this as root (via sudo)
  • ThomasMcLeod
    ThomasMcLeod almost 6 years
    Is this what you meant to say: "you can edit /etc/ld.so.conf and /usr/local/lib" ?
  • erTugRul
    erTugRul over 4 years
    But 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?
  • MiloDC
    MiloDC over 4 years
    This doesn't work for me (CentOS 6). Library file still not found.