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, 2019 in Linux Administration by Atul
• 5,540 points
151 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, 2019 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, 2019 in Linux Administration by DareDev
• 6,850 points
10,946 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, 2019 in Linux Administration by Omkar
• 69,030 points
385 views
0 votes
1 answer

How to create a symlink in Linux?

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

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,030 points
165 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, 2019 in Linux Administration by DareDev
• 6,850 points
130 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
188 views
0 votes
1 answer

Install postgreSQL on Ubuntu

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

answered Mar 22, 2019 in Database by Nitesh
155 views
0 votes
1 answer

Access progrs prompt without switching accounts

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

answered Mar 22, 2019 in Database by Mahi
105 views
0 votes
1 answer

Display shared libraries used by executables in linux

In order to do this, you need ...READ MORE

answered Jul 3, 2019 in Linux Administration by ajs3033
• 7,280 points
178 views
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, 2019 in Linux Administration by ajs3033
• 7,280 points
330 views