Kickstart Configuration Details(RedHat Linux KickStart HOWTO?) :)

View previous topic View next topic Go down

Kickstart Configuration Details(RedHat Linux KickStart HOWTO?) :)

Post  Admin on Fri Aug 06, 2010 11:58 pm

Kickstart Configuration Details
Here is an example kickstart configuration file(You can see this Code below). Each section is briefly described below.
• Preamble
o The preamble, at the top of the file, specifies generic configuration defaults for our site. Note that the disk partitioning is specified in this section. In order to work around well-known issues with kickstart disk partitioning it is done instead in the %pre section, and simply included in the preamble with an %include directive.
• %packages
o The list of package groups installed in the cluster is a small subset of the usual desktop linux system. In particular we aim for nearly complete development systems without common desktop package groups. The 'YUM', 'APT, and 'Packages added to Scientific Linux' are comps groups that are specifically provided by Scientific Linux.
A few additional individual packages are added, and unnecessary individual packages are removed.
• %pre
o The pre section is used to partition the disk. It is important to note that this example does the following:
 selects the first hard disk for partitioning. This is done somewhat intelligently for IDE disks, and rather stupidly for disks that appear as SCSI disks, in which case /dev/sda is simply specified.
 WIPES any pre-existing partitions off this disk using the o option of fdisk:

o create a new empty DOS partition table
 creates a standard set of partitions with sizes as mentioned in the example ks config file.
• %post
o The post section is the most complex part of the script where we try to configure the node as completely as possible. Major tasks include:
 delete unwanted services
 make some adjustments in /etc/fstab
 synchronize this node with our generic configurations in /ks/rtrees/VERSION/os/, and with any specific configuration meant only for this host in /ks/rtrees/VERSION/nodes/`hostname`/
 apply SL errata
 add local accounts
 install and configure as much as possible the target LCG packages meant for this node.

===================================================================================
kickstart configurator CODE
## Generated by kickstart configurator and heavily changed by Denice
# and then shamelessly emacs'ed by Rod.
# example boot from cdrom or cdromdisk1image
with:
# linux ks=http://trshare.triumf.ca/~deatrich/ks/303.cfg
# linux ks=nfs:lcfg.triumf.ca:/ks/kscfg/303.cfg
# NOTE: dir path and architecture hardcoded in nfs directive
##
#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone utc
America/Vancouver
#Root password
rootpw iscrypted
$1$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
nfs server
lcfg.triumf.ca dir
/ks/mirror/303/i386
#System bootloader configuration
bootloader location=
mbr
#System authorization information
auth useshadow
enablemd5
#Network information
network bootproto
dhcp
#Firewall configuration
firewall disabled
#XWindows configuration information
xconfig depth=
16 resolution
1024x768
## We are going to wipe anything on the first (hda/sda) disk here!
%include /tmp/partinclude
##
#Package install information
%packages resolvedeps
@ X Window System
@ Textbased
Internet
@ Engineering and Scientific
@ Editors
@ Emacs
@ System Tools
@ Development Tools
@ Development Libraries
@ Legacy Software Development
@ Compatibility Arch Support
@ Compatibility Arch Development Support
@ Legacy Software Support
@ X Software Development
@ Packages added to Scientific Linux
@ YUM
@ APT
# Additional packages
tkinter
logwatch
sendmailcf
# Packages to remove
sndconfig
eclipse
XFree86doc
firstboot
aptfirstboot
aptautoupdate
hpoj
a2ps
tetex
tetexfonts
tetexafm
%pre
#!/bin/sh
## generic script to pick hd? or sda
hd="/dev/hda"
short="hda"
mymedia=""
for f in /proc/ide/h* ; do
mymedia=`cat $f/media`
if [ $mymedia == "disk" ] ; then
hd=`basename $f`
short=$hd
break;
fi
done
if [ $mymedia != "disk" ] ; then
if [ d
/proc/scsi ] ; then
hd="/dev/sda"
short="sda"
else
echo "ERR: unknown disk scheme. Exitting.."
exit 1
fi
fi
mknod $hd
echo "DBG: disk will be $hd"
sleep 10
## doing: 1 /boot (100M)
## 2 / (500M)
## 3 swap (2G)
## 2 /usr (4G)
## 2 /opt (2G)
## 2 /var (500M)
## 2 /tmp (300M)
## 5 /home (rest of disk)
echo | fdisk $hd <<EOF
o
w
EOF
sleep 1
echo | fdisk $hd <<EOF
n
p
1
+100M
n
p
2
+500M
n
p
3
+2048M
t
3
82
n
e
4
n
+4000M
n
+2000M
n
+520M
n
+310M
w
EOF
sleep 1
echo part /boot onpart
$short""1 fstype
ext3 >/tmp/partinclude
echo part / onpart
$short""2 fstype
ext3 >>/tmp/partinclude
echo part swap onpart
$short""3 >>/tmp/partinclude
echo part /usr onpart
$short""5 fstype
ext3 >>/tmp/partinclude
echo part /opt onpart
$short""6 fstype
ext3 >>/tmp/partinclude
echo part /var onpart
$short""7 fstype
ext3 >>/tmp/partinclude
echo part /tmp onpart
$short""8 fstype
ext3 >>/tmp/partinclude
echo part /home size
500 grow
fstype
ext3 >>/tmp/partinclude
%post
##
## Make a temp dir structure to satisfy yum.conf; tear down before finishing.
## Note that the yum repositories will be accessible later via automounter.
setupmirror() {
mkdir /opt/mirror
ln s
/mnt/adm/mirror /opt/mirror/rpms
}
teardownmirror() {
rm /opt/mirror/rpms
rmdir /opt/mirror
}
## red hat version
rhver="303"
mountpt="/ks"
## switch to virt. console 3 so we can see console output
chvt 3
echo "Postinstall
section begins.."
## get rid of stuff that the automounter will handle later
rmdir /misc
rm /etc/auto.*
## dirs we use which are not necessarily made by kickstart
mkdir p
/local /mnt/adm /mnt/tmp /mnt/cdrom /mnt/floppy
## allow reading of messages file
chmod ugo+r /var/log/messages
## configure ntpd
mv /etc/ntp/ntpservers /etc/ntp/netservers.orig
## delete unwanted services
chkconfig del
kudzu
chkconfig del
xinetd
chkconfig del
cups
## we will not do autoupdates
push
manually instead after testing
chkconfig del
yum
## misc stuff not used or needed on rack stations
chkconfig del
isdn
chkconfig del
pcmcia
chkconfig del
gpm
## xemacs/asian fonts turned off
#chkconfig del
canna
#chkconfig del
FreeWnn
## stuff to turn on
chkconfig level
2345 ntpd on
#chkconfig level
345 nfs on
## Set up removable devices. Kickstart doesn't do them for us.
# (can't use %pre stuff here it
is forgotten)
# get cdrom drive (only first if more than one..)
hd=""
mymedia=""
for f in /proc/ide/h* ; do
mymedia=`cat $f/media`
if [ $mymedia == "cdrom" ] ; then
## we found a cdrom ; let's break out after the 1st one
hd=`basename $f`
break;
fi
done
## don't do anything for now if only scsi cdrom present
## might need to improve this
if [ $mymedia != "cdrom" ] ; then
cdline="#"
else
cdline="/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,ro 0 0"
ln s
/dev/$hd /dev/cdrom
fi
echo "DBG: cdrom dev was /dev/$hd"
## now add the removable devices to fstab (floppy on future machines?)
echo "
$cdline
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
" >>/etc/fstab
## configure network, get qualified and unqualified hostnames
qh=`grep HOSTNAME /etc/sysconfig/network|cut d=
f2`
h=`echo $qh|cut d.
f1`
echo "DBG: this host is $qh and unqualified name is $h"
## do the raids too, but commented out
case "$h" in
"lcgse01") echo "
#/dev/md0 /flatfiles/SE00 ext3 defaults 1 2
" >> /etc/fstab ;;
"lcgse02") echo "
#/dev/md0 /flatfiles/SE02 ext3 defaults 1 2
" >> /etc/fstab ;;
*) ;;
esac
## now we need nfs access to finish configuration
mount o
ro,nolock,wsize=8192,rsize=8192 lcfg.triumf.ca:$mountpt /mnt/adm
if [ $? ne
0 ] ; then
echo "DBG: Oh oh. mount failed?"
exit 1
fi
mtop=/mnt/adm/
RT=$mtop/rtrees/rsync$
rhver
# we could set n/w params statically here. But so far we are rsyncing
# it below
ip=`grep "$qh" $RT/os/etc/hosts | awk '{print $1}'`
echo "DBG: IP addr is $ip"
## import wellknown
RPM GPG keys from the distribution
echo "DBG: try to import key:"
rpm v
import
$mtop/mirror/$rhver/i386/RPMGPGKEYs/
RPMGPGKEY*
## here we syncrhonize common files from /etc /home /opt and /root/.ssh
if [ d
$RT ] ; then
set x
cp ab
$RT/os/etc /
cp ab
$RT/os/home /
cp ab
$RT/os/opt /
cp ab
$RT/os/var /
cp ab
$RT/os/root/.ssh /root/
set +x
#chmod gorwx
/root/.ssh/auth*
cd $RT/nodes
## in case we have specific files for this host we sync them here:
if [ d
"$h" ] ; then
for i in $RT/nodes/$h/* ; do
if [ d
"$i" ] ; then
$base=`basename $i`
set x
cp ab
$i /$base/
set +x
fi
done
fi
cd fi
# make sendmail so that we have a good client config
#cd /etc/mail
#sleep 1
#touch sendmail.mc
#make C
/etc/mail
setupmirror
## Save ourselves verbose console output and some time on updating
## systems by preinstalling the RPM headers for YUM
cache=/var/cache/yum
mkdir p
$cache/base
cp a
$mtop/mirror/$rhver/i386/SL/RPMS/headers $cache/base/
cp a
$cache/base/headers/header.info $cache/base/
rm $cache/base/headers/header.info
mkdir $cache/lcg2.3.0
cp a
$mtop/mirror/RPMS.lcg_2_3_0_sl3/headers $cache/lcg2.3.0/
cp a
$cache/lcg2.3.0/
headers/header.info $cache/lcg2.3.0/
rm $cache/lcg2.3.0/
headers/header.info
mkdir $cache/lcgCA
cp a
$mtop/mirror/RPMS.lcg_ca/headers $cache/lcgCA/
cp a
$cache/lcgCA/
headers/header.info $cache/lcgCA/
rm $cache/lcgCA/
headers/header.info
chown R
root:root $cache/.
### go for it! do all OS updates first (comment out when debugging)
yum y
update
## Add trteam account; its home will be rsynced
adduser u
501 M
trteam
usermod p
'$1$vxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/' trteam
useradd c
'Computing Services' d
/var/georgesv u
3276 r
m
k
/dev/null georgesv
## get rid of pesky cron jobs that are inappropriate for rackservers
rm /etc/cron.*/makewhatis.cron /etc/cron.*/slocate.cron
echo "DBG: Install LCG environment:"
## Node types:
# lcgWN
, lcgWNtorque
# lcgCE
, lcgCEtorque
# lcgSECLASSIC
# lcgUI
# lcgMON
case "$h" in
"lcggiis01") targ="lcgMON";
targconf="configure_MON";;
"lcgse01") targ="lcgSECLASSIC";
targconf="configure_classic_SE";;
"lcgse02") targ="lcgSECLASSIC";
targconf="configure_classic_SE";;
"lcgce01") targ="lcgCEtorque";
targconf="configure_CE_torque";;
"lcgce02") targ="lcgCE";
targconf="configure_CE";;
"lcgui01") targ="lcgUI";
targconf="configure_UI";;
*) targ="lcgWNtorque";
targconf="configure_WN_torque";
echo "DBG: This host defaults to a worker node configuration." ;;
esac
## install the CA's and the target LCG environment
yum y
install lcgCA
yum y
install $targ
## The (modified) yaim scripts will be synced
from /opt below.
## Therefore do NOT install the lcgyaim
rpm.
##yum y
install lcgyaim
# Do the yaim LCG configuration
ypath=/opt/lcg/yaim
SINFO=$ypath/etc/siteinfo.
def
echo DBG: $ypath/scripts/$targconf $SINFO
$ypath/scripts/$targconf $SINFO
## redo /var after yaim has trampled through it
tmpvar="$RT/nodes/$h/var"
if [ d
$tmpvar ] ; then
set x
cp ab
$tmpvar /
set +x
fi
## stop services that were started by badlybehaved
RPMs
cd /
#case "$targ" in
# "lcgWN")
;;
# "lcgUI")
;;
# *) /etc/init.d/mysql stop ;;
#esac
teardownmirror
umount /mnt/adm
#eject cdrom
echo "DBG: Thats all folks!"
echo "DBG: post install ENDS"
#

Admin
Admin

Posts: 29
Join date: 2010-07-29

View user profile http://unixtech.users-board.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum