Occasionally I find I need a package that isn’t in my distribution, or I need to rebuild from source for whatever reason. In the past, I’ve always been conflicted about that age old question:
Where do I install this bugger?
The default for most packages, /usr/local, is fine for most purposes, but then there are annoyances – if I want to use this package on other machines, then I’d be better to put it under ~ (/home/power), (our cluster has a shared NFS mount). But then I’m filling up my home directory with random bins and sbins and includes and if/when I need to uninstall something I always get confused and blow away the wrong thing (since all of the binaries end up in /home/power/bin)
Installing into subdirectories (/home/power/my-package) has it’s own annoyances – I have to make sure to update my $PATH everytime, and I start to get confused when there are too many things in my home directory (I don’t know why, I just do!).
Fortunately, I’ve come across a nice solution to all this. I install everything into /home/power/pkg:
power@kermit> ls -l pkg ... drwxrwxr-x 7 power power 4096 Nov 19 19:42 openmpi drwxrwxr-x 6 power power 4096 Jul 24 18:48 oprofile drwxr-xr-x 6 power power 4096 Feb 19 2011 paperpile drwxrwxr-x 4 power power 4096 Nov 6 2011 parallel drwxrwxr-x 5 power power 4096 May 9 2012 perl5 drwxrwxr-x 6 power power 4096 Apr 15 2012 postgresql drwxr-xr-x 7 power power 4096 Feb 9 2012 pypy-1.8 drwxr-xr-x 7 power power 4096 Jun 7 12:50 pypy-1.9 drwxr-xr-x 6 power power 4096 Apr 27 2012 python-2.7
And add the following to my bashrc:for d in /home/power/pkg/*/bin; do export PATH=$PATH:$d done for d in /home/power/pkg/*/lib; do export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$d done
Now every time I install a package under ‘pkg’, my PATH is automatically updated to discover it. And if do need to remove a package, I just blow away the directory.
I won’t claim that this is brilliant or original. But it works for me, so… it’s nice.