Cover V14, i04
apr2005.tar

Bootable SolarisTM Installation CD

Rytis Sileika

Have you ever found yourself needing to install two Sun servers one day, then a week later another one, then a few days later three more? Then somebody asks you to install yet another server exactly like the first one. You have probably already thought about creating a JumpStart server so you could install via the network, but say the last two servers that you installed were in a branch office far away, so there was no network connection.

What you really need is a CD that you just put in, push a button, and walk away for some coffee. And after that, you would have the server -- installed, secured, all patches applied, SSH access enabled. This all sounds great, but how do you do that? Just read on.

Preparation

Before you start creating a bootable CD, you should first prepare a work area. This is the place where you will put all scripts and packages that later will be placed onto the CD. It will require at least 2 GB of free space on a volume:

# mkdir -p /var/bootcd/s0
The contents of Solaris 8 Software 1 of 2 CD are used as a base for the Installation CD that I will describe in this article. All data is copied in three steps (put a Solaris 8 Software 1 of 2 CD into your CD ROM drive before you proceed):

Step 1: Copy Slice 0

Copy slice 0 of the CD-ROM to the work area. This slice contains all packages and configuration data, such as profile and rules files. This action may take up to 30 minutes depending on the speed of the CD-ROM drive:

# /etc/init.d/volmgt start 
# cd /cdrom/cdrom0/s0 
# find . -print | cpio -pudm /var/bootcd/s0
Step 2: Minimize Package Selection

Go to /var/bootcd/s0/Solaris_8/Product directory and delete all package directories except the ones listed in Figure 1. (Do not remove non-package directories; these are the ones that start with the . (dot) and a directory called locale.) The list shown in Figure 1 obviously can be adjusted to suit your needs, but it has proven to be sufficient for most of the applications.

Step 3: Copy the Remaining Slices

Copy slices 1 to 5. Slice 1 contains a temporary boot area. This boot area is used during the initial boot of the server. Slices 2 to 5 contain architecture-specific kernel boot images:

# /etc/init.d/volmgt stop
# cd /var/boot/cd
# for i in 1 2 3 4 5
> do
> dd if=/dev/dsk/c0t0d0s${i} of=sol.8.s${i} bs=512
> done
Step 4: Copy Recommended Patch Kit

Place recommended patch cluster in the installation directory (this example assumes that patch cluster archive is called 8_Recommended.zip and is placed in /tmp/ directory):

# cd /tmp
# mkdir /var/bootcd/s0/Solaris_8/Product/patches
# cp 8_Recommended.zip /var/bootcd/s0/Solaris_8/Product/patches
Step 5: Add Additional Packages

Although it is not necessary to perform this step, I find it quite useful to have man pages at hand, and most users are accustomed to BASH as their standard shell; therefore, I have included these two packages as well. Copy manual pages and BASH packages from the second Solaris Software CD:

# cd /cdrom/cdrom0/Solaris_8/Product
# cp -r SUNWbash SUNWman /var/bootcd/s0/Solaris_8/Product/
Customize the Configuration Files

The original installation CD contains some "universal" installation scripts, which we will replace with our own. Just empty the contents of /var/bootcd/s0/.install_config/ directory:

# rm -rf /var/bootcd/s0/.install_config/*
Customize .clustertoc Package Definition Files

These configuration files define Sun Software clusters that are available during the installation. Sun software clusters can be seen as "containers" that group packages and possibly other containers (or software clusters). Append the metacluster definition shown in Figure 2 to the .clustertoc.default and .clustertoc.dynamic files. These files can be found in the /var/bootcd/s0/Solaris_8/Product/locale/C/ directory.

Note that this list contains some package names that were not yet introduced (like SMCtcpwr). Details on this subject will follow shortly. If you want other packages to be installed automatically, please add them at the end of this list before the line with the keyword "END".

Modify the Profile Configuration File

This is a configuration file that defines how to install the Solaris software. A profile also defines which software groups to install:

# cd /var/bootcd/s0/.install_config/
# cat > profile

install_type    initial_install
system_type     server
cluster         CUSTWCbase

partitioning    explicit
filesys         rootdisk.s0     10240   /
filesys         rootdisk.s1     2048    swap
filesys         rootdisk.s3     free    /var
filesys         rootdisk.s4     4096    /opt
filesys         rootdisk.s5     4096    /usr
filesys         rootdisk.s6     10240   /data
filesys         rootdisk.s7     20      unnamed

^D
#
In this configuration file, we select the software cluster that we have defined earlier in .clustertoc configuration file. This file also contains the definition for the partition table. Size is specified in megabytes, so adjust it to suit your needs, but don't forget that the totals must not exceed the disk capacity.

Modify the Rules Configuration File

This configuration file is a text file that contains a rule for each group of systems. Systems can be identified, for example, by CPU architecture; more detailed information can be found in the Solaris advanced installation guide. Here we are going to use a "catch-all" file that would match all systems:

# cd /var/bootcd/s0/.install_config/
# echo "any any - profile finish" > rules
# ../jumpstart_sample/check -r rules
Validating rules...
Validating profile profile...
The custom JumpStart configuration is ok.
#
It is strongly not advised but, if the check script is not available, you can create the rules.ok file manually. Be aware that rules and profile files are not validated in this case:

# echo "any any - profile finish" > rules.ok
# echo "# version=2 checksum=1950" >> rules.ok
If you want to modify this file and do not have the "check" script at hand, you can use the sum command to calculate a checksum for a file.

Modify "Profind" Script

The setup of the installation profile is controlled by the profind script, which must be modified to point to the configuration directory. This script is responsible for finding the correct profile information during the installation. Edit the script /var/bootcd/s0/Solaris_8/Tools/Boot/usr/sbin/install.d/profind and replace the cdrom() function with the following function:

cdrom()
{
    # Factory JumpStart is only allowed with factory
    # stub images, indicated by the file /tmp/.preinstall
    #
    if [ -f /tmp/.preinstall ]; then
        mount -o ro -F lofs ${CD_CONFIG_DIR} ${SI_CONFIG_DIR} \
          >/dev/null 2>&1
        if [ $? -eq 0 ]; then
            verify_config "defaults" "CDROM"
        fi
    fi

    gettext "::: Custom Installation from CDROM  :::"; echo
    if [ ! -f ${SI_CONFIG_DIR}/rules.ok ]; then
        rmdir ${SI_CONFIG_DIR}
        ln -s /cdrom/.install_config ${SI_CONFIG_DIR}
    fi
}
What we're doing here is checking whether the rules.ok file is available. (This check is not really needed, since we've put the file in place, but is consistent with the good scripting manners.) So, if we have this file in place, we simply erase all files from the ${SI_CONFIG_DIR} directory (this variable is automatically set by JumpStart), and we link it to the directory on the CD, which contains all configuration files we created earlier.

Create "Finish" Installation Script

The "finish" script (Listing 1) is executed after Solaris Software is installed on the system, but before the system reboots. This is a very good place to perform some "polishing" actions on our new system.

I wanted to keep this configuration script in one piece within this text, so I included some comments explaining all the things this script is actually doing. Please take a close look at it before you put it into production.

Create a file called "finish" in the /var/bootcd/s0/.install_config/ directory (see Listing 1). Make the file executable:

# cd /var/bootcd/s0/.install_config/
# chmod +x finish
Modify the "Sysidcfg" Configuration File

This is a configuration file in which we specify a set of special system configuration keywords that pre-configure the system. The "sysidcfg" configuration file is located on slice 1 of the Software CD. It is not possible to directly change it, because we have copied it as a slice dump. So, mount Slice 1, so it can be modified:

# lofiadm -a /var/bootcd/sol.8.s1
/dev/lofi/1
# mount /dev/lofi/1 /mnt

# cd /mnt/etc
# rm sysidcfg
# cat > sysidcfg

terminal=vt100
system_locale=en_US
timezone=GB
timeserver=localhost
network_interface=primary
{
    ip_address=192.168.1.1
    netmask=255.255.255.0
    hostname=preinst
    default_route=192.168.1.254
    protocol_ipv6=no

}
root_password=EuEallLEarito
system_locale=en_GB.ISO8859-15
security_policy=NONE
name_service=NONE

^D
# chmod 777 sysidcfg
Here we put in some default configuration items and answers. This is to prevent JumpStart from asking questions during the installation.

Note that the default password is set to "asecret". Also, it is not sufficient to change the password only in "sysidcfg" file; the "finish" installation script must also be modified.

Next, unmount Slice 1:

# cd /var/bootcd
# umount /mnt
# lofiadm -d /dev/lofi/1
In this article, I covered the basic setup for our CD-based custom installation procedure. Next month, I'll show you some tricks for customizing your CD image. Please be aware that the procedure described in this article partially relies on the customization that will be described later, so it will all fit into place when you read the second part.

Rytis Sileika has worked in the IT industry for more than nine years. For the past four years, he has specialized in system installation and integration as a senior system integrator and platform architect in the telecommunication industry. He also has experience in planning and designing the configuration and installation of a wide variety of operating systems, clustering software, database software, and storage and networking subsystems.