Suppose I want to:

  • compile and install my own custom application
  • which requires downloading, compiling and installing the source for newest version of libthrift
  • which requires downloading, compiling and installing the latest version of libboost

Here, I'm installing these libraries in my system which may interact with other packages -- very many libraries depend on libthrift and libboost.

  • installing these may break existing package installed with apt-get/yum

Also, if I later run apt-get or yum:

  • my custom libthrift and libboost will be overwritten breaking my custom application that depends on custom versions of these libraries.

So, what's the solution here? I don't want to install into /home (I'd like the packages to be available to shared users in a code regression build cluster). I've also read that /opt is not really for this purpose (the packages installed should be self-contained, which they are not). The references I've found seem to cover this case in enough detail.


Generally, the solution is "don't try to install from source into directories managed by your packaging system".

You can install your custom-compiled code into /usr/local, for example, and having anything that depends on it look to /usr/local for libraries and include files using appropriate invocations of your build system (e.g., setting CPPFLAGS/CFLAGS/LDFLAGS for a typical Makefile).

You could even install everything into an application-specific directory (e.g., /usr/local/myapp, or /opt/myapp).

This is also a great use case for something like Docker, which makes it very easy to set up isolated development/runtime environments that are isolated from your host.

Not the answer you're looking for? Browse other questions tagged or ask your own question.