Solved

How to setup LD_LIBRARY_PATH  in Linux?

Posted on 2014-04-03
4
401 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
  • 2
4 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
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
Comment Utility
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
Comment Utility
@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
Comment Utility
@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 Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now