Open vieyahn2017 opened 5 years ago
PATH: 可执行程序的查找路径 查看当前环境变量: echo $PATH 设置: 方法一:export PATH=PATH:/XXX 但是登出后就失效 方法二:修改~/.bashrc或~/.bash_profile或系统级别的/etc/profile
LD_LIBRARY_PATH: 动态库的查找路径 设置: 方法一: export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/XXX 但是登出后就失效 方法二: 修改~/.bashrc或~/.bash_profile或系统级别的/etc/profile
例如: 对于用户production的LD_LIBRARY_PATH进行分析如下:
1、production@Africa:~> echo $LD_LIBRARY_PATH
/home/production/cpst/cptools/lib:/home/production/cpst/campost/lib:/home/production/tuxedo/lib:/home/production/tuxedo/jre/lib/amd64/server:/home/production/tuxedo/jre/jre/bin:/usr/lib:/usr/lib64:/lib:/lib64:/usr/local/lib:/usr/local/lib64:/oracle/product/11gR2/db/lib:/oracle/product/11gR2/db/ctx/lib
2、查看.profile:
.profile中有: . ~/cpst/campost/config/setenv,说明用户启动是运行脚本setenv。
3、setenv中有:
export CAMPOST_HOME=$HOME/cpst/campost
export CPTOOLS_ROOT=$HOME/cpst/cptools
export LD_LIBRARY_PATH=$CPTOOLS_ROOT/lib:$CAMPOST_HOME/lib:$LD_LIBRARY_PATH
4、setenv中有$LD_LIBRARY_PATH,进root查看:
(1)Africa:~ # echo $LD_LIBRARY_PATH
/usr/lib:/usr/lib64:/lib:/lib64:/usr/local/lib:/usr/local/lib64:/oracle/product/11gR2/db/lib:/oracle/product/11gR2/db/ctx/lib
(2)etc/profile中有:
export LD_LIBRARY_PATH=/usr/lib:/usr/lib64:/lib:/lib64:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
(3)/etc/profile.d/oracle.sh中有:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
linux环境变量设置方法总结(PATH/LD_LIBRARY_PATH) https://blog.csdn.net/faihung/article/details/56038870