Cover V04, I04
Figure 1
Figure 2
Listing 1


Automating Operating System Configuration

Jack Tuszynski


In an environment that includes a central network information service (NIS) and a network file system (NFS) server that attends to multiple desktop clients, a script can configure the client workstations quickly, efficiently, uniformly, and reliably. The install_client (ic) script I present here automatically sets up UNIX workstations to operate in a local area network. After you've loaded an operating system onto a workstation from a CD-ROM installation, you can run ic to configure the workstation for network operation.

CD-ROM Installation of Operating System and Commercial Software

The procedure for loading UNIX from CD-ROM to the system disk varies from platform to platform. Most manufacturers offer some type of standard partition table and collection of filesets which constitute the default installation. However, there are a number of options, so it's good practice to keep field notes regarding the decisions you make during the install; you can then simply repeat those steps for all subsequent installations on clients of the given model.

A consistent CD-ROM installation process within a given platform ensures that the same files and directories will reside on the system disk for each workstation (a prerequesite for the install_client script). The volume of the standard operating system structure imposes a minimum size requirement for the internal hard disks in the computers, which act as system disks. For smaller disks, you can either upgrade to a larger size, or reduce the number of files to be loaded.

Most UNIX operating system vendors also sell compilers and development tools and other application programs which they hardwire into their edition of UNIX. These programs, which are integrated into the operating system after the CD-ROM installation, change or add to the operating system files and directories and affect its operations. For example, Hewlett Packard's Softbench installs itself into /usr/softbench and overrides many of the actions of HP-VUE, the HP user workbench environment, which resides in /usr/vue. After Softbench is installed, the VUE environment is driven by the files in /usr/softbench rather than /usr/vue. Using an automated script to configure workstations requires a specific arrangement of files and directories on the system disk. For the install_client system to work, add-on programs must be implemented immediately after the operating system has been loaded and are then treated as if they were part of the default operating system installation.

Manual Installation Preparation Steps

Certain steps in installing the operating system must be performed manually. If, for instance, a site prefers xterms over hpterms or the C shell over the Bourne shell, or if there is a need to adjust the Delete key's actions on the computer's keyboard, the initial root environment has to be set up accordingly. Most computers require calibrating the ifconfig setting for the network cards to function properly. Also the proper entries for the default route need to be adjusted. Usually, workstations get defined as NIS clients during operating system installation. On some platforms, however, the NIS client setup entails turning on certain flags from the root account after the primary installation has been completed. The NFS system must be initialized, and the flags and states that turn a workstation into an automount client must be initiated. The workstation then needs to be rebooted to begin functioning as an NIS and NFS client.

Once the correct environment has been established, the network is functioning properly, and the flags and states to turn the workstation into an NIS and NFS client have been turned on, the automated process can take over. You initiate the process by ftping the ic script to the workstation, preferably to the /tmp working area. The script must be set to be executable. After the reboot, it's a good idea to make sure that NIS and NFS automount are indeed working. That done, the install_client script is ready to be run.

Automated Bootstrapping

The install_client procedure relies on data that resides on the file server. Before the main loop can begin, install_client needs to establish access across the network to the part of the file server which holds the maps and modifications used to arrange the operating system. To illustrate: if the files that the program needs are in the /usr/local/adm/clients subdirectory, then a link must be created in /usr to point to it.

A map called ic.txt outlines the changes to be made to an operating system. It uses the same type of format conventions as the UNIX /etc/passwd file. Figure 1 lists the fields of the ic.txt map and shows examples of their use. install_client uses these fields as parameters for the commands that turn a standard vanilla operating system into a client workstation. Special utilities allow you to safely edit the ic.txt map file. They are similar in nature to Solaris's useradd, usermod, and userdel instructions, which manage the /etc/passwd and shadow files.

A directory named lib, in the client's data area, holds the altered version of files from each separate operating system. For instance, if an inetd.conf file is configured to pass connections through a TCP/Wrapper, then the updated version of the inetd.conf file should be kept in the lib subdirectory. Every release of an operating system has a different subdirectory dedicated to storing its files in the client's area. A link to the latest version of an operating system maintains access to the most current version that is used by the install program. Backwardly compatible client versions must be prepared specially by changing the link back to an older version. Figure 2 shows how the lib subdirectory of the client's data area can be organized.

Using the ic.txt map to prepare workstations requires system administrators to keep track of variations in the operating system. As alterations occur to the operating system, the updated files must be copied to the install_client staging area. In practice, the ic.txt map and associated records serve a dual purpose: they formulate new nodes on a network, and they often help quantify what changes have been made and where to the many UNIX workstations that act as clients.

The uname command seems to have standard usage across the many flavors of UNIX. It enables a program to figure out the exact identity of the computer and the version of the operating system that it is running. A number of environment variables can be determined from the output of the uname command. Then a path must be generated which best utilizes the resources of the particular system. A unique time stamp must be generated once the location and structure of the date command is known. The time stamp is appended to all saved files during the main loop. It allows install_client to be run multiple times without overwriting or destroying critical data. Previous renditions of a file or directory are moved to a copy with the same name and a distinct suffix.

Automated Core Installation

The tasks required to install a client workstation can be grouped in several categories. Custom actions must be run before and after the main loop. Directories must be constructed. Files must be created or copied. And links must be implemented. The order in which these tasks must be done constitutes the structure of the install_client script, in Listing 1.

Several steps must be taken before the main loop begins. A switch statement guided by the platform on which ic is running determine which actions must be taken. For example, sendmail must be stopped before the install_client process begins, because you cannot copy a preferred and secure UC Berkeley sendmail binary into /usr/lib while sendmail is up and running.

The main loop creates directories, files, and links. The main loop interprets each record of the ic.txt map file and takes the appropriate steps to implement them, one by one. A log is displayed on the screen as the respective directories, files, and links are created in the operating system.

After the main loop finishes, various procedures get executed; again, a switch statement controlled by the platform on which ic is running determines which actions must be taken. For example, on the HP-UX platform, you might want to create a /dev/rscsi device with the aid of /etc/mknod so that users can listen to compact discs on their workstations.

Manual Post-Installation Steps

Depending on the operating system being initialized, several manual operations may need to be performed after the ic program has finished. For instance, a custom kernel rebuild or special patches may be required. These steps may not be lend themselves to being automated and so should be done separately from the install_client script.

After the installation process is completed, the machine should be rebooted again. When the machine becomes available, users should be able to login and use their accounts on the client workstations. Any special features of the computer are in place. The desktop workstation has been fully furnished with all of the standard amenities. The entire process normally takes approximately one to two hours of system administration time, including data loading from media, per node. Since most of the phases of the process are automated, this installation script method offers greater reliability and efficiency for setting up nodes in a client/server environment than manual construction techniques.

About the Author

Jack Tuszynski is a System Administrator and Programmer with NASA's Jet Propulsion Laboratory (JPL), Advanced Multimission Software Technology Group (AMST). He has administered Vax systems, PCs, and UNIX workstations for ten years. He holds a Master of Science in Computer Science degree from California State University, Northridge.