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,550 points
290 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
3 answers

Setting JAVA_HOME in linux

Hello fellow techies, Assuming you use bash shell ...READ MORE

answered Dec 9, 2020 in Linux Administration by Rajiv
• 8,880 points
26,689 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,110 points
616 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,110 points
245 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,890 points
187 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
291 views
0 votes
2 answers

Install postgreSQL on Ubuntu

Follow the below commands to install PostgreSQL (PSQL) ...READ MORE

answered Nov 11, 2020 in Database by Prachi
• 140 points
255 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
177 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
286 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
727 views