大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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 basi…

问题原文

原帖链接 · stackedAndOverflowed · CC BY-SA 4.0

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.

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

The ld.so(8) man page explains:

       LD_LIBRARY_PATH
              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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-06-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。