Solved

How to setup LD_LIBRARY_PATH  in Linux?

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
postfix start error! 9 85
Certificate Request CentOS/Apache 1 57
ossec: how to extend rules 1002 and 1003 2 44
Edit smb.conf-file in Samba om a ReadyNAS 3 72
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

732 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