8

I would like to know if it is possible to choose where a .deb file will be installed, or if it is possible to move it after the installation to another directory without troubles for the app.

I am asking that because I am running Ubuntu on a 32Go's SSD, and I would like to install some games from Humble Bundle on my other HDD.

3

2 Answers 2

7

There is a similar Q&A at superuser.com dealing with that question. A more specific question was asked also here at askubuntu.com.

Your choices are:

  • Use symlinks. Open the *.deb package with the archive manager. This tells you where the files go. Move those directories to your external harddisc and put a symlink at the origin. Be careful to move only directories from your games and not shared libraries or so!

  • Mount your external hardrive or some of its folders (a second time) at the game's path. E.g. /usr/share/games might be good candidate for your external harddisc. You can use the bind option, e.g.:

    sudo mount --bind /media/external-hardisc/usr-share-games /usr/share/games

  • Don't use a *.deb package, but install directly from source to a directory of your choice.

  • Use the dpkg parameter --root to change the install location. The man page says:

    --root=dir Changing root changes instdir to dir and admindir to dir/var/lib/dpkg.

    There is no guarantee that this will work. The program might not be able to deal with the different location.

(This list of solutions is not exhaustive.)

2

As I know extracted files like libraries and executables must be extracted into fixed directories that use these files during program execution. Also I think this debs contains large resources and lightweight files separately. For example many games unpack their resources to /opt directory. You can mount your HDD as /opt that store resources there:

Here is example:

sudo mv /opt /media/your_hdd/opt
sudo mkdir /opt

And check mount:

sudo mount --bind /media/your_hdd/opt /opt

if this works add mount --bind /media/your_hdd/opt /opt to /etc/rc.local before exit 0 to auto mount after each system boot.

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.