The following is a sample kscfg.tmpl File. See the kscfg.tmpl File man page or the IBM Cluster Systems Management for Linux Technical Reference for more information.
# #Kickstart Configuration File for RedHat 7.1 Only # lang en_US keyboard "us" network --bootproto dhcp # # Where's the source? # nfs --server hostname.of.server or IP --dir /path/to/RH/CD/image # nfs --server #NFS_HOSTNAME# --dir #NFS_DIR# # # Clear the MBR # zerombr yes # # Wipe out the disk # clearpart --all # # Disk partition table. Customize it to fit your needs. # /boot is strongly recommended # part /boot --size 50 --ondisk sda part / --size 1024 --ondisk sda part swap --size 1024 --ondisk sda part /var --size 1024 --ondisk sda part /opt --size 512 --ondisk sda part /usr --size 2048 --ondisk sda # # install or upgrade # install # # mouse selection # #mouse genericps/2 --emulthree mouse none # # Select a time zone # Add the --utc switch if your hardware clock is set to GMT # #timezone US/Hawaii #timezone US/Pacific #timezone US/Mountain #timezone US/Central #timezone US/Eastern timezone --utc US/Eastern # # Don't do X # skipx # # To generate an encrypted root password use: # # perl -e 'print crypt("blah","Xa") . "\n";'p # openssl passwd -apr1 -salt xxxxxxxx password # # where "blah" is your root password. # # --iscrypted is broken # #rootpw --iscrypted XaLGAVe1C41x2 #rootpw XaLGAVe1C41x2 --iscrypted rootpw cluster auth --useshadow --enablemd5 # # Lilo # lilo --location mbr # # Reboot after installation # reboot # #end of section # # # Choose the packages and package groups to install # %packages @ Networked Workstation compat-libstdc++ kernel-smp kernel-headers glibc-devel binutils cpp gcc flex autofs pdksh tcsh ntp xosview XFree86 tftp xinetd rsh rsh-server telnet-server pvm pvm-gui psacct nfs-utils raidtools ucd-snmp rsync yp-tools ypserv ypbind m4 sendmail-cf %post # # Post Install script # # This script may be modified as needed. However, certain sections should # not be altered or else the CSM installation will not work correctly. These # sections are marked with the text "DO NOT ERASE THIS SECTION". # # # The LOGGER variable is used to send items to some kind of log. It can be # set to 'write_log' in order to call the 'write_log' function (defined below) # which sends the log output to /var/log/csm/kickstart.log on the node. # If LOGGER is set to /usr/bin/logger, the Linux syslog facility is used # instead. # #export LOGGER=/usr/bin/logger export LOGGER=write_log # # Set variables # # The following variables are substituted into the kickstart template file # from the setupks tool # # MGMTSVR_HOSTNAME = management server (Long Hostname) # MGMTSVR_SHORTHOST = management server (Short Hostname) # MGMTSVR_IP = management server (IP) # NODE_HOSTNAME = node hostname (Long Hostname) # NFS_HOSTNAME = NFS Server (Long Hostname) - same as MGMTSVR_HOSTNAME # NFS_IP = NFS Server (IP) - same as MGMTSVR_IP # NFS_DIR = Path to RedHat CD image on NFS Server # TFTP_IP = TFTP Server (IP) - same as MGMTSVR_IP # NAMESERVERS = list of comma delimited name servers(IPs or Hostnames) # DNSDOMAIN = DNS domain name of the node(NAME) # SETUP_RSH = Set to "Y" if $DSH_REMOTE_CMD variable on the # management server is set to "rsh" or is blank. # export KICKSTART_LOGFILE=/var/log/csm/kickstart.log export MGMTSVR_HOSTNAME=#MGMTSVR_HOSTNAME# export MGMTSVR_SHORTHOST=#MGMTSVR_SHORTHOST# export MGMTSVR_IP=#MGMTSVR_IP# export NODE_HOSTNAME=#NODE_HOSTNAME# export NFS_HOSTNAME=#NFS_HOSTNAME# export NFS_IP=#NFS_IP# export TFTP_IP=#TFTP_IP# export NAMESERVERS=#NAMESERVERS# export DNSDOMAIN=#DNSDOMAIN# export SETUP_RSH=#SETUP_RSH# # # Hardcode some other variables # export GATEWAY=$(netstat -rn | grep 0.0.0.0 | tail -1 | awk '{print $2}') export CSM_MANPATH=/opt/man export CSM_PATH=/opt/bin export TFTPBOOT=/tftpboot export ATFTP=$TFTPBOOT/bin/atftp # # Function to add some text to the kickstart.log file on the node. # write_log() { mkdir -p /var/log/csm echo "`date`: $*" >> $KICKSTART_LOGFILE } # END write_log # # Use atftp to get a file from the management server. The remote file is # relative to /tftpboot # atftp_get() { _remote_file=$1 _local_file=$2 # Use this format if LOGGER=/usr/bin/logger #echo "get $_local_file $remote_file" | $ATFTP $TFTP_IP 2>&1 | $LOGGER # Use this format if LOGGER=write_log $LOGGER "`echo \"get $_remote_file $_local_file\" | $ATFTP $TFTP_IP 2>&1`" } # END atftp_get # # Use atftp to put a file to the management server. The remote file is # relative to /tftpboot # atftp_put() { _local_file=$1 _remote_file=$2 # Use this format if LOGGER=/usr/bin/logger #echo "put $_remote_file $local_file" | $ATFTP $TFTP_IP 2>&1 | $LOGGER # Use this format if LOGGER=write_log $LOGGER "`echo \"put $_local_file $_remote_file\" | $ATFTP $TFTP_IP 2>&1`" } # END atftp_put # # Function to add a line to the status file on the management server. # The status file is in the /tftpboot/status directory on the management server. # # The first argument to this function is the message. It should be quoted # if it contains spaces. The second optional argument is a status. This is # typically used to send the exit code of a command to the status log. # # The format of the output message in the status file is: # <date>: <message>: <status> # If <status> is not provided, the format of the message in the status file is: # <date>: <message> # # This function uses atftp to transfer the status file back and forth. The # atftp server should have been setup on the management server automatically # when csm.server was installed. The atftp client resides in the mounted # /tftpboot filesystem. So this function cannot be used until after the # /tftpboot filesystem is mounted. # write_status() { msg=$1; status=${2:-''} remote_file="status/$NODE_HOSTNAME" local_file="/tmp/${NODE_HOSTNAME}.status" $LOGGER "Writing status to $remote_file. MSG=$msg" # Get the previous version of the status file /bin/rm -f $local_file #$LOGGER "`echo \"get $remote_file $local_file\" | $ATFTP $TFTP_IP 2>&1`" atftp_get $remote_file $local_file # Add a line to the status file if [ "$status" ] then echo "`date`: $msg: status=$rc" >> $local_file else echo "`date`: $msg" >> $local_file fi # Write the new version of the status file #$LOGGER "`echo \"put $local_file $remote_file\" | $ATFTP $TFTP_IP 2>&1`" atftp_put $local_file $remote_file /bin/rm -f $local_file } # END write_status $LOGGER "Starting Install" #netstat -rn | $LOGGER # Use this format if LOGGER=/usr/bin/logger $LOGGER "`netstat -rn`" # Use this format if LOGGER=write_log # # Setup Syslog # # Turn syslog so we can use $LOGGER to send messages to syslogd running on a # management node. Use $LOGGER. # # Uncomment this if you want all syslog messages from the node to be sent to # the management server. Be sure to also uncomment the section that says # "Setup Syslog again" (below) # #mv /etc/syslog.conf /etc/syslog.conf.ORIG #echo "*.* @$MGMTSVR_IP" >/etc/syslog.conf #/etc/rc.d/init.d/syslog start #$LOGGER "Install: syslog setup" ####################### DO NOT ERASE THIS SECTION (begin) ##################### # # Mount /tftpboot # $LOGGER "Mounting $TFTPBOOT" # Use this format if LOGGER=/usr/bin/logger #mkdir $TFTPBOOT 2>&1 | $LOGGER #mount -o nolock $NFS_IP:$TFTPBOOT $TFTPBOOT 2>&1 | $LOGGER # Use this format if LOGGER=write_log $LOGGER "`mkdir $TFTPBOOT 2>&1`" $LOGGER "`mount -o nolock $NFS_IP:$TFTPBOOT $TFTPBOOT 2>&1`" write_status "Kickstart RPM Installation Complete." write_status "Starting Kickstart Post-Install." ####################### DO NOT ERASE THIS SECTION (end) ####################### # # Hardcode eth0 (optional, recommended) # $LOGGER "Setting up eth0" IP0=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}') BC0=$(ifconfig eth0 | grep inet | awk '{print $3}' | awk -F: '{print $2}') SM0=$(ifconfig eth0 | grep inet | awk '{print $4}' | awk -F: '{print $2}') cd /etc/sysconfig/network-scripts cp ifcfg-eth0 ifcfg-eth0.ORIG echo "DEVICE=eth0 BOOTPROTO=none ONBOOT=yes USERCTL=no IPADDR=$IP0 BROADCAST=$BC0 NETMASK=$SM0" >ifcfg-eth0 # # Setup /etc/resolv.conf # $LOGGER "Setting up /etc/resolv.conf" mv /etc/resolv.conf /etc/resolv.conf.ORIG if [ "$DNSDOMAIN" ] then echo "search $DNSDOMAIN" >/etc/resolv.conf fi for i in $(echo $NAMESERVERS | tr ',' ' ') do echo "nameserver $i" done >>/etc/resolv.conf # # Setup /etc/sysconfig/network # $LOGGER "Setting up /etc/sysconfig/network" HOSTNAME=$(host $IP0 2>/dev/null | awk '{print $5}' | sed 's/\.$//') SHORT_HOSTNAME=$(echo $HOSTNAME | awk -F. '{print $1}') cp /etc/sysconfig/network /etc/sysconfig/network.ORIG echo "NETWORKING=yes HOSTNAME=$HOSTNAME FORWARD_IPV4=yes GATEWAYDEV=eth0 GATEWAY=$GATEWAY" >/etc/sysconfig/network # # Setup /etc/hosts # Add myself and the management server # $LOGGER "Setting up /etc/hosts" echo "127.0.0.1 localhost $IP0 $SHORT_HOSTNAME $HOSTNAME $MGMTSVR_IP $MGMTSVR_SHORTHOST $MGMTSVR_HOSTNAME" > /etc/hosts # # Add users (optional) # # The following line produces an encrypted password of "cluster" # perl -e 'print crypt("cluster","Xa") . "\n";'p # $LOGGER "Adding users" adduser admin -u 1000 -p `perl -e 'print crypt("cluster","Xa") . "\n";'` # # Enable rsh, add management server to /root/.rhosts and add 'rsh' to # /etc/securetty to allow root to rsh to the node. # if [ "${SETUP_RSH}" = "Y" ] then if [ -r /etc/xinetd.d/rsh ] then $LOGGER "Enable rsh" # Could use chkconfig to do this #perl -pi -e 's/^(\tdisable[^=]*=) yes/$1 no/' /etc/xinetd.d/rsh chkconfig rsh on $LOGGER "Allow root to rsh" echo "rsh" >> /etc/securetty $LOGGER "Setting up /root/.rhosts" cd /root echo "$MGMTSVR_SHORTHOST" >.rhosts echo "$MGMTSVR_HOSTNAME" >>.rhosts chmod 600 .rhosts fi fi # # Setup PAM (optional, recommended) # # Uncomment this if you want to enable ftp, login, rlogin, rsh, sshd #$LOGGER "Setup PAM" #cd /etc/pam.d #for i in ftp login rlogin rsh sshd #do # echo "account required /lib/security/pam_access.so" >>$i #done #echo "-:ALL EXCEPT root:ALL" >>/etc/security/access.conf #cp /etc/security/access.conf /etc/security/access.conf.BOOT #echo "cp /etc/security/access.conf.BOOT /etc/security/access.conf >/dev/null 2>&1" >>/etc/rc.d/rc.local # # Setup man paths in /etc/man.config. Add CSM_MANPATH after /usr/local/man. # $LOGGER "Setup man paths" cp -f /etc/man.config /etc/man.config.ORIG FIXEDMANPATH=$(echo $CSM_MANPATH | sed 's/\//\\\//g') perl -pi -e "s/^MANPATH[\t ]+\/usr\/local\/man$/MANPATH\t\/usr\/local\/man\nMANPATH $FIXEDMANPATH/" /etc/man.config # # Setup paths. # Add PATH definitions to /etc/profile.d/csm.sh and /etc/profile.d/csm.csh # Add section to /etc/csh.login that source's all the *.csh files # in /etc/profile.d/ (just like /etc/profile does for *.sh files). # $LOGGER "Setup PATHS" echo "export PATH=\$PATH:$CSM_PATH" >/etc/profile.d/csm.sh echo "setenv PATH \"\${PATH}:$CSM_PATH\"" >/etc/profile.d/csm.csh chmod 755 /etc/profile.d/csm.* echo " test -d /etc/profile.d if (\$status == 0) then set nonomatch foreach i ( /etc/profile.d/*.csh ) test -f \$i if (\$status == 0) then source \$i endif end unset i nonomatch endif" >>/etc/csh.login # # Setup services # $LOGGER "Setup services" #chkconfig --del apmd #chkconfig --del gpm #chkconfig --del kudzu #chkconfig --del lpd #chkconfig --del pcmcia #chkconfig --del linuxconf #chkconfig --del sendmail #chkconfig --del xfs #chkconfig --del httpd #chkconfig --del autofs #chkconfig --del identd #chkconfig --del isdn #chkconfig --del pppoe #chkconfig --level 345 ntpd on #chkconfig --level 345 sshd on #chkconfig --level 345 snmpd on chkconfig telnet on # # Setup Syslog Again # # Uncomment this if you want all syslog messages from the node to be sent to # the management server. Be sure to also uncomment the section that says # "Setup Syslog" (above) # #$LOGGER "Syslog setup again" #echo "*.* @$MGMTSVR_IP" >/etc/syslog.conf # # Set local and remote complete install flag # Put file in /dev/sda1 date >/boot/install_complete ####################### DO NOT ERASE THIS SECTION (begin) ##################### # # Create a pxelinux configuration file for this node and tftp it to the # management server. This pxelinux file will cause the node to boot to # the hard disk on the next reboot after the install is complete. The # CSM code will be installed during the first reboot of the hard disk. # $LOGGER "Update pxelinux configuration on management server" IP=$(ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}') HEX=$( for i in $(echo $IP | tr '.' ' ') do printf "%02x" $i done | tr '[a-z]' '[A-Z]' ) cd /tmp # # Use atftp to copy the HEX file over to the management server. # The HEX file contains a new pxelinux configuration that causes the node # to boot from hard disk on the next reboot. # echo "#boot" >$HEX #$LOGGER "`echo \"get pxelinux.cfg/$HEX blah\" | $ATFTP $TFTP_IP 2>&1`" atftp_get pxelinux.cfg/$HEX blah grep SERIAL blah >>$HEX echo "DEFAULT xCAT LABEL xCAT LOCALBOOT 0" >>$HEX #$LOGGER "`echo \"put $HEX pxelinux.cfg/$HEX\" | $ATFTP $TFTP_IP 2>&1`" atftp_put $HEX pxelinux.cfg/$HEX # # Copy the node's firstboot script from /tftpboot to the node # mkdir -p /opt/csm/bin/ /bin/cp /tftpboot/bin/$NODE_HOSTNAME.firstboot /opt/csm/bin/firstboot chmod 755 /opt/csm/bin/firstboot # # Add the firstboot script to /etc/inittab. The firstboot script runs only during # the first reboot of the hard disk. It runs 'makenode' to install CSM on the node. # if grep "^csm:" /etc/inittab > /dev/null then # Line already exists so leave it true else $LOGGER "Adding firstboot entry to /etc/inittab" # Add comment and firstboot entry to /etc/inittab echo " #CSMFIRSTBOOT: The firstboot script runs only after the node is booted the #CSMFIRSTBOOT: first time after full install. Firstboot then removes this #CSMFIRSTBOOT: entry from /etc/inittab. csm:345:wait:/opt/csm/bin/firstboot" >> /etc/inittab fi # # Copy the kickstart log to the management server in /tftpboot/status # local_file=$KICKSTART_LOGFILE remote_file="status/$NODE_HOSTNAME.kickstart.log" atftp_put $local_file $remote_file # # Tell the management server that the install is complete. # write_status "Kickstart Post-Install Complete." write_status "Rebooting to hard disk." # # Unmount $TFTPBOOT # $LOGGER "Unmounting $TFTPBOOT" cd / umount $TFTPBOOT rmdir $TFTPBOOT ####################### DO NOT ERASE THIS SECTION (end) ####################### cd / $LOGGER "Install complete" exit 0