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 ffdfd
• 5,550 points
1,287 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,300 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 10, 2020 in Linux Administration by Rajiv
• 8,870 points
78,901 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,220 points
2,568 views
0 votes
1 answer

How to create a symlink in Linux?

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

answered Feb 1, 2019 in Linux Administration by Omkar
• 69,220 points
1,191 views
0 votes
1 answer

Finding pat of afile in linux

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

answered Mar 15, 2019 in Linux Administration by DareDev
• 6,890 points
938 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
1,180 views
0 votes
2 answers

Install postgreSQL on Ubuntu

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

answered Nov 12, 2020 in Database by Prachi
• 140 points
1,268 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
844 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,300 points
1,434 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,300 points
2,749 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP