Background Info There are many ways to install software on a UNIX machine. In a single machine environment, it doesn't really matter how it gets done, until it's time to update, or upgrade, the software. In a multi-platform, multi-system environment managed by a central group, the way software is installed and maintained is much more important. Generically, users have /usr/local/bin in their PATH, so if software is installed into /usr/local/bin by the sys admin, it is available to the users of the system. The problem with this process comes when attempting to install the software package on multiple systems via rdist, and/or upgrading the software.
A better way to keep the software package together is to make it live
completely in a "package directory". For example, if a system has perl
verion 5.003 installed and needs perl 5.6.1, the upgrade process is easier
if the old package was in /usr/local/pkg/perl_5.003 and the new package
is compiled to live entirely in /usr/local/pkg/perl_5.6.1. Many software
packages are distributed with source code and configure scripts that
allow for easy relocation by using the --PREFIX option(s). Sometimes the
software will need to build several times to ensure all dependencies are
in the package directory. The strings utility is a convenient tool for
finding strays;
After the package is built to live completely in the package directory, with no config files or other dependencies external to the package directory, it is very easy to copy the package from one machine to another. Here is a example of a command line to copy perl to another machine: - nieusma@server2$ sudo -v - nieusma@server1$ sudo -v - nieusma@server1$ ( cd /usr/local/pkg; sudo tar cBf - perl561 ) |\ ssh server2 'cd /usr/local/pkg ; /usr/local/bin/sudo tar xpf -' This is all fine and good, but it creates a problem. If the software is not installed in /usr/local/bin, users will need to modify their PATH in order to use the newly installed software package. That is not a good thing. So, because the sys admin's job is to make the users' experience easy, sometimes we have to go out of our way. The easiest thing we can do is make symbolic links in the directories that the users already have in their PATH: /usr/local/bin, /usr/local/sbin, /usr/local/man. So, after all the work necessary to create a self contained package directory, we will also have to write an Install script. The Install script should check for existing links to older (or other) versions of the software, and replace them with links to the new (or current) package. When creating these links, it is pretty important to remember the difference between linking to ../pkg/perl561/bin/perl and linking to /usr/local/pkg/perl561/bin/perl. All the links should be relative (../) to allow them to work in the event the disk is mounted in a different place than expected. If the source code is not available, or there is some other unforseen circumstance preventing the total elimination of external "dependencies" a different approach will be needed. Since the software still has to live in a package, we need to make a list of the external dependencies, and create symbolic links external to the package from the Install script. A good example of this is building a new sendmail package. The Install script will need to delete /usr/lib/sendmail and replace it with a link to the new binary because there are so many programs that assume sendmail lives at /usr/lib/sendmail. Again, be sure all the symbolic links are relative and not absolute.
Assumptions It is assumed that users have /usr/local/bin in the PATH and /usr/local/man in the MANPATH by one, or more, of the following means
Procedure for a new software package
Procedure for replicating a package to another server
Examples
Simple install script for lynx
A slightly more complicated script for perl
A more complex script for samba which starts services at boot time |