[英]linux - Append LD_LIBRARY_PATH for all users
I need to append a few paths to my LD_LIBRARY_PATH
variable. 我需要为
LD_LIBRARY_PATH
变量添加一些路径。 This is very simple to do on a per user basis by adding export LD_LIBRARY_PATH=...
to my ~/.bashrc
file. 通过将
export LD_LIBRARY_PATH=...
添加到我的~/.bashrc
文件中,这对于每个用户而言非常简单。 However, I would like to have this added for all users. 但是,我想为所有用户添加此功能。
Is there a place I can add the export LD_LIBRARY_PATH=...
so that the environment variable will be appended for all users? 是否可以添加
export LD_LIBRARY_PATH=...
以便将环境变量附加到所有用户?
Thanks! 谢谢!
You can add the path to /etc/ld.so.conf
. 您可以将路径添加到
/etc/ld.so.conf
。
If this is about third party software in a non-standard install path, you may want to look at the stow
utility instead, which is a symlink farming helper that will help you catch name conflicts between installed software. 如果这是关于非标准安装路径中的第三方软件的,则您可能需要查看
stow
实用程序,它是一个symlink耕作助手,可帮助您捕获已安装软件之间的名称冲突。
You can add it to the global /etc/profile, but this may not be the solution you are looking for. 您可以将其添加到全局/ etc / profile中,但这可能不是您想要的解决方案。 LD_LIBRARY_PATH has some pitfalls, such as being dropped for setuid binaries and not being indexed by the ld.so cache.
LD_LIBRARY_PATH有一些陷阱,例如被setuid二进制文件删除并且未被ld.so高速缓存索引。
If you just want to add global system-wide library paths, the correct place to do them is in the /etc/ld.so.conf file which is just a list of directories. 如果只想添加系统范围的全局库路径,则正确的位置是/etc/ld.so.conf文件,该文件只是目录列表。 after you add to it, be sure to run 'ldconfig' as root to scan the new directories.
添加到它之后,请确保以root用户身份运行“ ldconfig”以扫描新目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.