Solved

How to setup LD_LIBRARY_PATH  in Linux?

Posted on 2014-04-03
4
418 Views
Last Modified: 2014-04-21
I am new to Linux environment. I coped oracle client library under /home/test/instantclient. Now I am wondering how can set up the environment variable in Linux.

Thanks for your help
0
Comment
Question by:LolaPet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39976184
To set it for a specific user add this line:

export LD_LIBRARY_PATH=/home/test/instantclient:$LD_LIBRARY_PATH

to the end of the file ".bashrc" in the home directory of the concerned user (Note the leading dot ".").

To get a system wide setting add the above to the end of /etc/bashrc (Note: "bashrc" without the leading dot).
0
 
LVL 13

Accepted Solution

by:
duncanb7 earned 500 total points
ID: 39976193
Did you try one of these  as follow ?

 1-
modify the file .bash_profile :
add the below lines to .bash_profile:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/test/instantclient
and then in terminal type:
 #source ~/.bash_profile,

2-  For TCSH: setenv LD_LIBRARY_PATH=/home/test/instantclient

3-  For BASH: export LD_LIBRARY_PATH=/home/test/instantclient

4- With most modern distribution (works on Debian, Ubuntu and openSUSE), the loading of shared library is controlled in configuration files ( namely "/etc/ld.so.conf" and all conf files in "/etc/ld.so.conf.d")

Go in directory " /etc/ld.so.conf.d "
As root (for exemple " sudo nano ", or whatever) add a file named " cuda.conf "
Type in the path to the oracle library "/home/test/instantclient", and save the file
As root run " /sbin/ldconfig " to update


And what is your linux distribution you are using , Debain or Centos ?

Duncan
0
 
LVL 23

Expert Comment

by:David
ID: 39977925
@woolmilkproc in (39976184), right idea, but your example seems off -- you expand the variable as if it were previously defined; and omit the library subdirectory.  To clarify:

...
export myhome = '/home/test/instantclient'
export LD_LIBRARY_PATH = $myhome/lib

Or if the variable was in use, the path could be extended to:
export LD_LIBRARY_PATH = /home/test/instantclient/lib:$LD_LIBRARY_PATH

@lolapet, a reminder to check your syntax with:
> env|sort
and look for the variable values
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39978394
@dvz - how can you know that there is a "lib" subdirectory? The asker didn't mention it.

My example works regardless of whether LD_LIBRARY_PATH was already definded or not.

Finally, don't use spaces around "=" when assigning variables.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question