3

I want to install (say) Python in a manner that it is maximally separated from the system and system provided libraries and programs. It should be compiled in its own directory in which it lives and only need access to system provided stuff it needs to compile. (This is similiar to the way in which Julia (cf. section "Source Download and Compilation") is compiled from source.) However, I am unsure how to do this in general. Running ./configure will create a Makefile that is tailored to use system provided libraries and I do not have sufficient experience in handwriting my Makefile; especially with programs that have a wide range of dependencies and given the fact that I will need to do this for a range of programming languages. Can you give me some good advice how to do this in a more efficient way than manually writing a Makefile?

(I am currently running Arch Linux but I intend this to be a more generic question, i.e. solutions should be generalisable.)

lord.garbage
  • 5,884
  • 5
  • 36
  • 55
  • 1
    `./configure` normally lets you select all the paths from which it will try to look up the libraries it needs. – RedX May 23 '14 at 08:24
  • 1
    Ok, so my default strategy would be to find out all the dependencies of (to stick with my original example) Python, download them into the folder in which I wish to compile python. Then I tell `./configure` that it should only look in - let's call the folder for the dependencies "deps" -, create my `Makefile` and then simply run `make`. Does this seem like a good idea? – lord.garbage May 23 '14 at 08:28
  • It does not sound like a good idea to begin with :D but since you are set on doing it, you could also use a tool (i forget the name) which constrains a programm to only access it's subfolders. This way you can guarantee that all the files you need are present. – RedX May 23 '14 at 09:16

1 Answers1

2

I have been looking into different options over the last weeks and I came up with two possible solutions I find satisfactory.

    (1) LXC
    (2) Docker

Both provide analogous solutions so I will just concentrate on LXC here.

An LXC container allows me to set up an isolated environment for basically any program I want. I think it is not useful to explain what LXC is and how it works here as there are so many questions and answers on StackExchange sites that already do this. Hence, I put together a bunch of links to StackExchange questions with good answers regarding LXC. I hope people will find this useful:

(A) StackExchange Sites:

Simple and general introduction in plain words what LXC is: Explain in Plain English what is LXC and for what it is useful [closed]

Another general introduction: What is LXC and how to get started?

A similar question: Lightweight isolated linux environment

Explaining in detail and summarising the differences between Docker and LXC: What does Docker add to lxc-tools (the userspace LXC tools)?

Explaining the difference between Docker/LXC and a full-blown VM: How is Docker different from a normal virtual machine?

(B) External Sites:

A good general introduction to LXC: Arch Wiki - Linux Containers.

Community
  • 1
  • 1
lord.garbage
  • 5,884
  • 5
  • 36
  • 55