Local installs
From Peyton Hall Documentation
(New page: {{oldfaq|NUM=170}} Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (...) |
m (Local or "Home Directory" installs moved to Local installs) |
Revision as of 19:02, 15 May 2007
Here's a trick which I've started doing on my Mac, and you can do on any other machine to make it simple to install software without needing administrative privileges (and it's easy to clean up if you reinstall/remove the software later on, too!)
First, create a directory where your software installs will live. I call mine "Installs", so
mkdir ~/Installs
is the command to run. Now, let's say the program you want to install is called FooGram. I create a directory called ~/Installs/FooGram, and download the source to that directory. Uncompress it like usual, which will normally create a directory called ~/Installs/FooGram/FooGram-1.2.3 for example. This directory contains the source. Go to compile as you normally would, however if the program uses 'configure' as the first step, use the following:
./configure --prefix=~/Installs/FooGram
This tells configure that you want to install the software not in the normal /usr/bin or /usr/local/bin location, but in a directory tree based from ~/Installs/FooGram. When done compiling and installing, you will probably have directories like this:
~/Installs/FooGram/bin ~/Installs/FooGram/lib ~/Installs/FooGram/share
..and perhaps others. Now, to tell your shell how to handle these things, so that you can run the program just like any other. For bash, I have the following in my ~/.bashrc:
for D in ~/Installs/* ; do if [ -d $D/bin ]; then export PATH=$PATH:$D/bin ; fi if [ -d $D/man ]; then export MANPATH=$MANPATH:$D/man ; fi done
Now, for each of the directories in which I have software installed, the proper PATH value is appended to my normal $PATH. So I can just run "foogram" from a prompt, instead of running "~/Installs/FooGram/bin/foogram". Also, since $MANPATH is updated, I can type 'man foogram' and have it work. Note that after a new install, you will have to logout and login again for the change to be noticed - but that's a pretty small price to pay.
Later on, if you decide to remove the program, you need only delete the entire ~/Installs/FooGram directory and it's gone - no more hunting in multiple shared/bin/sbin/lib/man directories to find all the files that go with some bit of software. Or you can move the directory out of the way, install a newer version, and then remove the old one when you're sure it's working as expected.