Changing the default installation directory?

28,772

Short answer:

No.

Long answer:

When installing packages through your package manager (apt, which relies on dpkg), the files in the .deb archive get extracted and moved to the place they are supposed to be. Configuration files go to /etc, binaries to /usr/bin or other bin dirs, libraries to /lib, etc. The standard that specifies which file goes where is the FHS (File Hierarchy Standard). If you make changes to the installation directories, you will most likely violate this standard. Anyway, dpkg has an --instdir option, but it would mess up things if used globally.

Answer to your REAL problem:

As I read in your comment, the reason you want to do this is because you've run out of space on your root partition, but you have still plenty of it under /usr/local.

Changing the installation directory is not a solution, you should repartition your hard drive. You can resize partitions if you don't want to reinstall the system (which is not necessary at all). Try booting a live partitioning system such as GParted if you prefer graphical tools (for the command line, check out parted and fdisk).

The other solution (I would prefer this since it allows more flexibility in the future) is to set up LVM. LVM stands for Logical Volume Management, which allows (apart from other awesome features) resizing partitions without losing data and having to repartition your hard drive. It is a bit too complicated to be explained here, but there are great guides on it. One such is HowToForge and you can also check out the relevant ArchWiki page.

Share:
28,772

Related videos on Youtube

Alex
Author by

Alex

Updated on September 18, 2022

Comments

  • Alex
    Alex over 1 year

    Is there a way to change the directory where applications are installed? I mean instead of /usr/bin can I change the settings to install them at /usr/local/bin or something like that, as long as they are in the PATH variable?

    Currently using Ubuntu 14.04 64 bit.

    If the solution depends upon the package manager, is there any generic approach? Which configuration file(s) should I target?

  • jiggunjer
    jiggunjer about 7 years
    does this still apply to all modern package managers?