In CentOS what does the line LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 do?

stackedAndOverflowed asked:

Hosting: new droplet on Digital Ocean

Operating system: fresh install of CentOS 7.6.1810

Question: I installed OpenSSL 1.1.1 from source using a tutorial but I don’t understand what the following 2 lines do. I understand the basics of Linux but I don’t know how to read these.

:~# export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
:~# echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64" >> ~/.bashrc

Secondarily when I check the version it returns 1.1.1.

:~# openssl version
:~# OpenSSL 1.1.1  11 Sep 2018

However when I look at what’s installed it still shows the old OpenSSL 1.0.2k.

:~# yum list installed | grep openssl
openssl.x86_64                          1:1.0.2k-16.el7_6.1        installed
openssl-devel.x86_64                    1:1.0.2k-16.el7_6.1        @updates
openssl-libs.x86_64                     1:1.0.2k-16.el7_6.1        installed

My sense is that somehow those first two lines are connected to this problem but I can’t understand them. I hate to robotically do something without understanding what is going on.

My answer:

The man page explains:

              A  list  of  directories in which to search for ELF libraries at
              execution time.  The items in the list are separated  by  either
              colons  or  semicolons,  and  there  is  no support for escaping
              either separator.

              This variable is ignored in secure-execution mode.

By setting this in your environment, you cause programs you run to search for shared libraries in those directories first. It looks like your tutorial author intends for this to override the system OpenSSL packages with your locally installed OpenSSL version.

View the full question and any other answers on Server Fault.

Creative Commons License