what to do next after manually installing a program in Linux

1

Because I don't have the administration permission on the Linux server, so I have to install all the software with configure, make, make install to a local directory so as to avoiding permission denied.

For example, I will do the following to install a program:

./configure --prefix=/myDir/bin
make
make install

After the installation, I get some files created in the /myDir/bin, such as:

bin/
include/
lib/
lib64/
libexec/
share/

My question is after the installation, what should I do?

With some searching, I find that to many about set LD_LIBRARY_PATH, LIBRARY_PATH, PKG_CONFIG_PATH ... But I'm not quite clear about the functionality of those settings.

What is the complete setting and configuration after make install?

宇宙人

Posted 2014-10-17T12:50:47.160

Reputation: 147

Answers

0

The "complete setting and configuration after make install" is going to depend on what software you're installing. What I'd do is start with the common/most important stuff, and add things as needed afterwards:

  • PATH: determines where to search for programs. If you want your session to find and use the ones you installed you need something like: export PATH="/myDir/bin:$PATH" in your profile. Otherwise you have to call, say, /myDir/bin/ls each time.

  • LD_LIBRARY_PATH: is used to control which shared libraries (.so files) are used when running dynamically linked executables. If unset, system's libs will be used. If set, the directories it points to will be searched first. If you have installed .so files you'll need to set it so that your programs find it:
    export LD_LIBRARY_PATH=/myDir/lib

    Be aware that this could affect system binaries which will now start using your libraries instead. If you want to be safe don't set it globally and use wrapper scripts instead to run programs:

    #!/bin/bash
    export LD_LIBRARY_PATH=/myDir/lib
    exec /myDir/bin/firefox "$@"
    

Compiling stuff:

  • CFLAGS/CPPFLAGS: used by gcc/g++ when compiling source code. Set it to tell it where your headers are: export CFLAGS=-I/myDir/include

  • LDFLAGS: used by gcc when linking. Set it to tell it where your libraries are:
    export LDFLAGS=-L/myDir/lib

You need to set these two for configure scripts to find your libraries. You could also use a config.site file.

  • PKG_CONFIG_PATH: used by pkg-config to find its files. Normally it looks under /usr/share/pkgconfig for .pc files. If you're going to be compiling more programs that need your libraries and there's stuff in /myDir/share/pkgconfig you'll want to set that one also.

The rest you can figure out as needed: man super_duper_prg doesn't work ? man's doc will tell you about MANPATH.

lemonsqueeze

Posted 2014-10-17T12:50:47.160

Reputation: 1 151

Thanks for your replay, currently I meet such a case, where I need to compile and install the git from source. It turns out that it needs zlib installed beforehand. So I turn to install the zlib into the /myDir and and /myDir into LD_LIBRARY_PATH. But when I make git, it still shows can not find zlib.h. I know one solution is to configure with --with-zlib, is there a way to avoid that with just setting? – 宇宙人 – 2014-10-18T00:38:39.943

Yes, you need to set CFLAGS and LDFLAGS variables. I edited my answer. – lemonsqueeze – 2014-10-18T08:00:45.660