Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to install software packages, similar to apt-get install <foo> but:

  1. Without sudo, and
  2. Into a local directory

The purpose of this exercise is to isolate independent builds in my continuous integration server.

I don't mind compiling from source, if that's what it takes, but obviously I'd prefer the simplest approach possible. I tried apt-get source --compile <foo> as mentioned here but I can't get it working for packages like autoconf. I get the following error:

dpkg-checkbuilddeps: Unmet build dependencies: help2man

I've got help2man compiled in a local directory, but I don't know how to inform apt-get of that. Any ideas?

UPDATE: I found an answer that almost works at http://askubuntu.com/a/350/23678. The problem with chroot is that it requires sudo. The problem with apt-get source is that I don't know how to resolve dependencies. I must say, chroot looks very appealing. Is there an equivalent command that doesn't require sudo?

share|improve this question
I suggest that's a duplicate of this question : [askubuntu.com/questions/147654/… [1]: askubuntu.com/questions/147654/… – user91632 Sep 27 '12 at 14:30
2  
@kamil, it's not. I'm not trying to install without network access. I'm trying to install without sudo and into a non-system directory. – Gili Sep 27 '12 at 14:35
Guys, please don't downvote my question without explaining why. Thank you. – Gili Sep 27 '12 at 15:11
+1 because I don't see a reason for downvote. – January Sep 27 '12 at 16:49
If you don't have root on the system, you will not be able to resolve dependencies easily. It is sometimes possible, though; you would have to start installing the software in your home, starting with the bottom-most dependencies, and modifying your LD_PATH so that programs can find their libraries. However, you will fail if any of the packages requires root (or suid) to run. – January Sep 27 '12 at 16:51
show 2 more comments

1 Answer

up vote 3 down vote accepted

This is, in general, not doable, because you would mess with the apt dependencies system.

There are two solutions:

  1. Install the source package, change into the source directory, configure and install the package irrespective of the packaging systems manually to a directory of your choice.

    apt-get source <package>
    

    This does not need root, downloads the package source, unpacks it in a directory within the current directory. You can then change to that directory, make modifications to the source, configure the installation to another target etc.

    Configuring to which installation directory the programs should go depends, however, on the particular program. Many programs use the ./configure --prefix localdir to target the installation to localdir; but this is by far not always the case.

  2. Create a chroot environment into which you will install the packages:

    debootstrap precise myfancyinstall
    

    Now you have created a dummy installation in the myfancyinstall/ directory

    chroot myfancyinstall
    

    You can use apt-get install within the chroot cage to install whatever you wish.

share|improve this answer
This looks promising. Using apt-get source without --compile seems to suppress the warning about unmet dependencies (allowing me to resolve them myself) – Gili Sep 27 '12 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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