Solved

How to setup LD_LIBRARY_PATH  in Linux?

Posted on 2014-04-03
4
433 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

728 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