Easily manage environment variables for new/removed software packages
First, keep any custom-compiled or custom-loaded software packages in /usr/local: Red Hat and Fedora's package managers never install stuff in /usr/local, and never harm stuff that you have installed in /usr/local. /usr/local is assumed to be software packages "local" to your machine. (And, in case you have to reformat and re-install Red Hat or Fedora, you did make /usr/local its own partition, didn't you?)
Second, keep standalone software packages with their own bin/ and
lib/ directories in their own directories off /usr/local. So, when you
install Adobe's Acrobat, for instance, it is disirable to have
the binary in /usr/local/Acrobat5/bin/acroread; do not
copy it to /usr/local/bin/acroread.
Or, for any jdk you get from sun, get the self-unzipping archive and also
leave the directory structure in /usr/local, leaving the binaries in
/usr/local/j2sdk1.4.2_07/bin, not
/usr/local/bin. This way, it's easy to remove any software package from
/usr/local:
rm -rf /usr/local/Acrobat5
is all you need.
Of course, now you've got the problem of having to add /usr/local/Acrobat5/bin and /usr/local/j2sdk1.4.2_07/bin to every user's PATH, a potential administration nightmare! Well, remember, you are on Unix, an operating system that was designed by programmers and not marketers and focus groups, so there's actually quite an elegant solution to this problem.
What you want to do is add the following loop to the end of /etc/profile, which every sh and bash user sources on login:
# Added by System Administrator, 23 June 2004 for f in /usr/local/*/add_to_env.sh ; do if [ -r "$f" ]; then . $f fi done unset f
Now, you create a file named /usr/local/Acrobat5/add_to_env.sh with the following lines:
PATH=$PATH:/usr/local/Acrobat5/bin export PATH
Or, for java, you can create /usr/local/j2sdk1.4.2_07/add_to_env.sh:
JAVA_HOME=/usr/local/j2sdk1.4.2_07 export JAVA_HOME PATH=$PATH:$JAVA_HOME/bin export PATH