Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any option to install a package to my home directory (or /foo) instead of system wide ? I am looking for options using apt-get or dpkg. Something similar to --prefix in a source compile.

What I am looking for co-existing of different versions of openJDK for testing purposes.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

A debian package needs to be comliant to the FHS, that clearly defines where to put data and where to install applications on any system. This clear structure makes administration easy and we all should stick to that.

In your case, when it comes to testing applications an installation to a custom directory may be desired. However there is no way to tell your package manager not to use the predefined file locations from an exisiting DEB package.

If you need an installation to another location you may need to compile your package from source, as you already pointed out. Alternatively, and if you need to use dpkg you will have to build your own private DEB where you can define other installation paths. If however the application relies on access to files located on a FHS-compliant path it may not run the way developers intended.

For installing testing versions of applications you may consider a chroot (or schroot) environment. The safest solution (though maybe overkill) for testing is installing applications in a virtual OS (e.g. through Virtual Box)

share|improve this answer
    
Thanks. On further looking to 'man dpkg', I saw this and yet to evaluate. --instdir=dir Change default installation directory which refers to the directory where packages are to be installed. instdir is also the directory passed to chroot(2) before running package's installation scripts, which means that the scripts see instdir as a root directory. (Defaults to /). –  Jamess Feb 5 '11 at 10:19
    
I tried to install an already existing package using this switch and I could not do it since the dpkg -i command detected my old package and warned me. Something like "Preparing to replace "foo" with foo.deb". So looks like source compile is the only way –  Jamess Feb 5 '11 at 10:28
1  
--instdir works and dumps the files to my directory. But this is not much useful in practise. This expects a chrooted environment. If I have a chrooted setup in this directory, I can use 'sudo chroot mydir' and use it. –  Jamess Feb 5 '11 at 10:44
add comment

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.