[Reprint]linux environment variable setting method summary (Path/ld_library_path)

Source: Internet
Author: User

Http://blog.chinaunix.net/uid-354915-id-3568853.html

path: The lookup path to the executable program
To view the current environment variables:
Echo $PATH
Set up:
Method One: Export path=path:/xxx but fails after logout
Method Two: Modify the ~/.BASHRC or ~/.bash_profile or system level/etc/profile
1. Add For example export Path=/opt/activepython-2.7/bin: $PATH
2. Source. BASHRC (The source command is also known as a "point command", which is a dot symbol (.).) The source command is typically used to re-execute a newly modified initialization file for immediate effect without having to log off and log back in.
Ld_library_path: Find path for dynamic libraries
Set up:
Method One: Export ld_library_path=ld_library_path:/xxx but fails after logout
Method Two: Modify the ~/.BASHRC or ~/.bash_profile or system level/etc/profile
1. Add For example export path=/opt/activep/lib: $LD _library_path
2. Source. BASHRC (The source command is also known as a "point command", which is a dot symbol (.).) The source command is typically used to re-execute a newly modified initialization file for immediate effect without having to log off and log back in.
Method Three: This is not modified Ld_library_path but the effect is the same as the implementation of dynamic library search,
1. Add a line below/etc/ld.so.conf/usr/local/mysql/lib
2. Save after Ldconfig (the purpose of the Ldconfig command, mainly in the default search directory (/lib and/usr/lib) and dynamic Library configuration file/etc/ld.so.conf listed in the directory, the search for a shareable dynamic link library (format as described above, lib*.so*) to create the connection and cache files required for the dynamic loader (ld.so). The cache file defaults to/etc/ld.so.cache, which holds the list of queued dynamic-link library names.)
Method Three is slightly cumbersome, and the benefit is that the comparison is not restricted by the user.
For example:
The Ld_library_path for user production is analyzed as follows:
1.[email protected]:~> 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. View. Profile:
The. Profile has:. ~/cpst/campost/config/setenv, stating that user startup is running script setenv.
3. The setenv has:
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 in the $ld_library_path, into the root view:
(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) The Etc/profile are:
Export ld_library_path=/usr/lib:/usr/lib64:/lib:/lib64:/usr/local/lib:/usr/local/lib64: $LD _library_path
(3) The/etc/profile.d/oracle.sh are:
ld_library_path=${ld_library_path:+ $LD _library_path:} $ORACLE _home/lib: $ORACLE _home/ctx/lib

[Reprint]linux environment variable setting method summary (Path/ld_library_path)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.