Ubuntu – Install package to specified directory, e.g, some where under /home


I do not want packages to be installed under /. (sudo apt-get install …).

The reason why I need to do this is that:

My '/' is mounted with my SSD(16GB) and my hard disk(500GB) is mounted at '/home'.

I have already installed my Ubuntu 12.04 on that SSD. There is not much free space under '/' now.

Best Answer

You can not do that with sudo apt-get install.


  • Get a bigger disc.
  • If the disc has more operating systems re-partition such that Ubuntu has at least 10Gb. Ubuntu works perfectly fine with 10Gb. I have never even reached that (and I use both apache and mysql on my system where mysql does not use my ssd for the databases ;) )
  • Re-install your system such that the directories where software is installed are mounted on the other (500Gb) disc (like /home is mounted in your 2nd disc you can also mount /etc/, /bin/ on that disc).
  • Install all software manually from source. But this will not help when installing the base system and all its default software.


  • you could also switch to another operating system. Redhat has an option (--relocate) in their package system where you can set where to install. So does Gentoo (prefix; but entoo installs from source so this is not a package manager).
Related Question