When I install a software using apt-get it installs to default locations i.e to /usr/bin, /usr/lib, /usr/share and etc. For example when I install "Meld Diff Viewer" using

sudo apt-get install meld

and use whereis command to find its location, I get the following output

adnan@adnan-laptop:~$ whereis meld
meld: /usr/bin/meld /usr/lib/meld /usr/share/meld /usr/share/man/man1/meld.1.gz

Is there any way to change the install location. Lets say if I want to install it in /usr/local/ can I do it using apt-get or aptitude? I know I can compile it from source and specify prefix option to configure script or make install but it would be better (and really easier) if I could do it using apt-get as I would be able to use uninstall, upgrade and other stuff that apt-get offers

2 Answers 2


Most programs are looking for files they need (like config files, GUI ressources, ...) on a few hardcoded places and will refuse to works if those files aren't there. To change this places you usually need to recompile the programs (but sometimes you can use command line options or environment variables instead).

dpkg and apt offer a way to change the install location (as far as I remember it's --root= with dpkg and Dir::Root in the apt config - but check the docs if you really need it). This is so you can mount another systems's root dir on your system and install packages on it (like if you have diskless systems mounting their root via NFS from a server).


For what i know the directories where it will install the desire software is inside the .deb package. If you need to change that, you need to change the package altogether. This is because the way to install and where to install it must be a standard between packages originating from a deb package so no chaotic installs are made. The structure of the deb package, where each type of file goes to ensure the correct standardization of the software for debian based packages must be always the same. This way everyone knows where a certain package always installs the software it has inside the package.

  • According to Wikipedia entry about deb file format: "Debian packages are standard Unix ar archives that include two gzipped, bzipped or lzmaed tar archives: one that holds the control information and another that contains the data." If you take a look at data archive inside meld deb file you will find usr directory which contains bin, lib and share subdirectories. So paths are not hard. My understanding is that when you install a deb file the data directory gets extracted in root (/) which makes the files appear in /usr/bin, /usr/lib and /usr/share
    – binW
    Dec 24, 2010 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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