How to install libraries without sudo?

1

I want to run a lengthy computation on a cluster computer. The cluster computer has a Linux OS and a compiler but no GUI, just a command line. The problem is that I cannot use the sudo command to install additional libraries.

My program is in C++ and uses some Qt stuff such as QString. It also uses GSL and Eigen libraries. I am especially worried about the Qt libraries, since the installation seems nontrivial and the libraries seem very large.

I am making all my development on an Ubuntu OS, but my knowledge of Linux is minimal.

What do you suggest? Have you ever installed Qt "locally"? I can also attempt to refactor Qt out of my program using std::string and standard C++ equivalents where possible.

Martin Drozdik

Posted 2013-12-16T17:59:06.003

Reputation: 145

2Question is better suited to unix.stackexchange.com – John Dibling – 2013-12-16T18:08:16.393

Answers

2

Your options are pretty much twofold: Have your system administrator install the libraries in the "normal" location for you, or check the documentation for how to install them in a directory to which you have write access (probably under your home directory) and then link your application against that.

Mark B

Posted 2013-12-16T17:59:06.003

Reputation: 136

3

If you have uploaded your shared-object (.so*) libraries to your home directory, modifying your LD_LIBRARY_PATH environment variable[1] might work. On my system, this variable is empty, which indicates that I would add /lib, /usr/lib, and any other default system library paths to this variable first, like

export LD_LIBRARY_PATH=/lib/:/usr/lib:/home/user/lib

If LD_LIBRARY_PATH is nonempty, try

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/user/lib

1: http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

Larry

Posted 2013-12-16T17:59:06.003

Reputation: 31

But can I just take the library from my local Ubuntu system and use it "as is" in a different Linux system? – None – 2013-12-16T18:11:28.287

The short answer is "yes."

In practice, shared libraries often link against other shared libraries, meaning that you would need to be sure to copy those as well.

The ldd command will be really useful. – Larry – 2013-12-16T20:53:05.813