Setting environment variables in linux

0 votes

I am trying to set a path for LD_LIBRARY_PATH.

I tried to execute:

export LD_LIBRARY_PATH=/usr/local/lib

Then I opened the bash_profile file:

vi ~/.bash_profile

and added:

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

Now if I restart the terminal, typing echo $LD_LIBRARY_PATH displays no result.

How do I set this path permanently?

May 13 in Linux Administration by Atul
• 5,530 points
31 views

1 answer to this question.

0 votes

You need to add more information about your distribution. So for ubuntu you'll have to add a custom .conf file to /etc/ld/so/conf/d:

sudo gedit /etc/ld.so.conf.d/randomLibs.conf

Now in this file write the complete path to the directory containing the libraries that you want to add.

/home/linux/myLocalLibs

Just remember to add the path to the directory and not the file itself. All the files inside the directory will automatically be indexed.

Once done, just run:

sudo ldconfig

This will update the system with new libraries.

answered May 13 by ajs3033
• 7,280 points

Related Questions In Linux Administration

0 votes
1 answer

Setting JAVA_HOME in linux

find /usr/lib/jvm/java-1.x.x-openjdk vim /etc/profile Prepend sudo if logged in ...READ MORE

answered May 24 in Linux Administration by DareDev
• 6,810 points
716 views
–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3 in Linux Administration by Omkar
• 67,660 points
127 views
0 votes
1 answer

How to create a symlink in Linux?

To create a symbolic link, you can ...READ MORE

answered Jan 31 in Linux Administration by Omkar
• 67,660 points
77 views
0 votes
1 answer

Finding pat of afile in linux

You can use readlink command: readlink -f filename.txt for ...READ MORE

answered Mar 15 in Linux Administration by DareDev
• 6,810 points
32 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
93 views
0 votes
1 answer

Install postgreSQL on Ubuntu

Installing PostgreSQL on Ubuntu is very simple, ...READ MORE

answered Mar 22 in Database by Nitesh
64 views
0 votes
1 answer

Access progrs prompt without switching accounts

Use the following to get the postgres prompt ...READ MORE

answered Mar 22 in Database by Mahi
42 views
0 votes
1 answer
0 votes
1 answer

How t find httpd.conf file in apache?

First f all, get apache's path: $ ps ...READ MORE

answered Feb 27 in Linux Administration by ajs3033
• 7,280 points
45 views