"Linux Gazette...making Linux just a little more fun!"


Mark's Kickstart Examples

By Mark Nielsen


If this document changes, it will be available at The Computer Underground: http://www.tcu-inc.com/mark/articles/Kickstart.html.
  1. Resources.
  2. What is kickstart?
  3. Gripes and Complaints
  4. Cdrom upgrade example.
  5. Advanced -- Ftp example
  6. Conclusion -- it is good
  7. My perl script

Resources.

The Kickstart HOWTO is very very good.

  1. On the Redhat 6.0 cdrom, look at /doc/README.ks
  2. man mkkickstart
  3. http://www.redhat.com/corp/support/manuals/RHL-6.0-Manual/install-guide/manual/doc129.html
  4. http://www.redhat.com/mirrors/LDP/HOWTO/KickStart-HOWTO-6.html
  5. http://redhat.google.com/redhat?q=kickstart&search=redhat

What is Kickstart?

One note, I think it would be a good if someone made a follow-up article for other Linux distributions. I would be more than happy to help.

KickStart for RedHat makes it so you can do a quick installation of RedHat 6.0 without having to go through all the installation menus. It automates it for you from start to finish (assuming nothing goofs up in between). This is handy for multiple installations. All you have to do is create a "ks.cfg" file on the RedHat 6.0 boot disk. Then boot off of the disk, type in the command "linux ks=floppy" on the first screen, and if you are lucky, when it starts the installation process, it should be able to grab that file and do the whole installation for you.

Here are the key points you need to be aware of,

  1. If you don't have a bootdisk for RedHat 6.0, you need to make one. Either use "rawrite" that comes on a RedHat 6.0 cd while in DOS, or mount the cd in Linux and assuming you mounted the cd at /mnt/cdrom and you have a floppy disk in (that doesn't have anything important on it),
    cd /mnt/cdrom/images
    dd if=boot.img of=/dev/fd0
    ## OR if you are installing off the net
    dd if=bootnet.img of=/dev/fd0
  2. The RedHat 6.0 boot disk is formatted as an msdos disk, thus you can copy the "ks.cfg" file to it in Windoze or in Linux. If you need to mount the floppy disk in Linux, try,
    mkdir -p /mnt/floppy
    mount -t msdos /dev/fd0 /mnt/floppy
  3. Kickstart can be installed using a cdrom, over the net through ftp or nfs, and for multiple computers you can use DHCP. It has other features as well. For this example, we will use a static ip addresses.
  4. It is assumed we are using standard IDE hard drives and cdroms. If you have SCSI devices, or other weird devices, you will have to modify the kickstart file so that it will work.
  5. Something weird happened on one of my installs. After installing RedHat 60, I tried to do an upgrade and somehow it found over 100 megs of programs to install as an upgrade even though I didn't do anything to the system. Weird. I did it again, and it installed 115 packages which had a total of 112 megs. I don't think it had to install those rpms again, but that it was an automatic thing with the upgrade option , whether or not you have those rpms installed.

Gripes and Complaints

Well, I have some gripes and complaints. Overall, the kickstart disk is pretty cool and has improved since 5.2, but still, it seems a little braindead or it doesn't give you the absolute power you need sometimes. I want the ability to shoot myself in the foot if I want to. It might sound weird, but here are my points:
  1. I couldn't find a "select all rpms" option. This makes it annoying since I have to list all the rpms. Perhaps I was blind, but I didn't find that option.
  2. I can't tell it to force a graphics card and monitor settings with a certain resolution. This is annoying. Xconfigurator doesn't work for me half the time, and I need to configure Xwindows after an installation. An easy way to do this, in a manual installation, is to set the computer to VGA 16 and to install the drivers for the true card later. If you set it to VGA 16 and it thinks it is something else, kickstart will error and stop the installation process and ask you for more info.
  3. I wish I could force the name of the computer so that it doesn't stop and ask you what the name of the computer should be if it doesn't find it in the DNS server. I would like the ability to shoot myself in the foot and put in incorrect settings just because I want to.
  4. It is pretty stupid about making Linux partitions. It only wants to see one primary partition and to put everything else into logical partitions. This is silly especially in multi-boot systems. It just grabs the rest of the hard drive space after the primary partition and puts it all into one extended partition. I would like the ability to specify primary or logical partitions. It would be nice if someone were to help make it so you can create a script which would automate the commands for fdisk. Perhaps there is and I just don't know about it.
  5. Is there a way to tell it to use a partition that is already defined? It seems as though it only can use the partitions that it creates. It would be nice if I could define the partitions ahead of time, and in the kickstart disk tell it which partitions go to which directories.
Don't get me wrong, kickstart is a cool way of doing things, I just would like to see it brought to a different level where it is "very" cool. Cool = give me all the power to shoot myself in the foot just so I can see what happens. A little bit of pain never hurts anyone. Also, I am not a real expert at Kickstart, so perhaps I just didn't catch some of the options I am griping about. I have only been using it for about 2 months at the time of this document.

Cdrom upgrade example

Copy what is between the lines to a file called "ks.cfg" to your boot disk. Then, when you get to the first screen of the Linux installation, type "linux ks=floppy". Also, before you do this, make sure the BIOS in your computer is set to boot off of the floppy drive.

#         Copy this file as "ks.cfg" to the boot disk that comes with
#		RedHat 6.0. Or make your own boot disk. Anyways, the
#		 bootdisk is formatted msdos, so you can use a Windows	
#		computer to copy this file to it. Also, when the prompt
#		comes up after you boot off of the floppy disk, type
#		linux ks=floppy
#		and press enter. 

#  This is just the configuration you need to do an upgrade using a cdrom. 
#
#

	### Choose the most popular language in the world.
	### This always upsets the French. 
lang en

        ### Tell it to use the cdrom to get the rpms
cdrom

        ### Tell it to use a us keyboard
keyboard us

       ### Tell it this is an upgrade and not a regular install 
upgrade

	### Tell it to install Lilo at the master boot record
lilo --location mbr

%post

echo "Hey dude, this is an example of a post install command using echo."
echo "You probably won't be able to see it though if perl isn't executed."

PATH=$PATH;/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
export PATH

ldconfig

perl -e '$A = 50; print "\nSleeping for 20 seconds. Test variable = $A\n"'
perl -e 'sleep 20'



An installation over ftp

Well, this configuration uses ftp, and if you wanted to use nfs, you could comment the ftp option and uncomment the nfs option. All you need is a floppy drive and a network card. Makes things a little easier if you can cut out a cdrom drive in each of your computers. Also, use a 100 mbit network. My installations using ftp were actually faster than installing off of the cdrom when I had a 100 mbit network. A 40 speed cdrom still isn't as good as a fast network with a few computers. A 100 mbit hub is really cheap these days.

#----------


#         Copy this file as "ks.cfg" to the boot disk that comes with
#		RedHat 6.0. Or make your own boot disk. Anyways, the
#		 bootdisk is formatted msdos, so you can use a Windows	
#		computer to copy this file to it. Also, when the prompt
#		comes up after you boot off of the floppy disk, type
#		linux ks=floppy
#		and press enter. 

	### Choose the most popular language in the world.
	### This always upsets the French. 
lang en

	### Tell it what the ethernet cards settings should be
	### If your nameserver 10.0.1.15 doesn't exist or doesn't
	### have 10.0.1.21 listed in it, it will ask you for a name.
network --bootproto static --ip 10.0.1.10 --netmask 255.255.255.0 --gateway 10.0.1.15 --nameserver 10.0.1.15

	### Uncomment this if you have nfs setup on the server
        ### If so, comment the "url" line. 
	### If you decide to use an nfs server, make sure you
        ### put "/home/ftp/RedHat60" in your /etc/exports file.
# nfs --server 10.0.1.15 --dir /home/ftp/RedHat60

   ### Make sure /home/ftp/RedHat60 exists on the server
   ### Also, have the cdrom mounted to /home/ftp/RedHat60 on the server.
   ### You can do this with 
   ###          mkdir -p /home/ftp/RedHat60 
   ###		mount /dev/cdrom /home/ftp/RedHat60  
   ### In case you don't have a nameserver, use numbers for the url
url --url ftp://10.0.1.15/RedHat60

        ### Tell it to use the cdrom to get the rpms
# cdrom

	### Tell it to use an Intel 10/100 EtherExpress ethernet Card
device ethernet eepro100
	### Tell it to use a us keyboard 
keyboard us
	### Tell it to blow away the master boot record on the hard drive
zerombr yes
	### Tell it to do a dumb move and blow away all partitions
clearpart --all
	### Make a swap partition, and unfortunately, this will go on a
	### logical  partition.
part swap --size 100
	### It will make a primary partition for root, 2 gigs 
	### I couldn't find a command to check for bad sectors. Is there one?
        ### I don't think "grow" will work here, unfortunately 
part / --size 2000 
	### Make a directory /OtherDir which is at least 1 gig and grows
	### to fill out the rest of the hard drive
	### Since "Kickstart" is literally an unintelligent program, 
	### it will put this partition on a logical partition
	### even though there are plenty of primary partitions to use. 
part /Backups --size 1000 --grow

	### Tell it to use a MicroSoft compatible mouse  
mouse --kickstart microsoft --device ttyS1
	### Let it know we are doing an install and not an upgrade	
install 
	### Tell the timezone we are in
timezone --utc US/Eastern
	### Tell it to use standard VGA 16, but sometimes it croaks
	### at this point and asks you anyways to select a card
	### I really wish you could force to install for a particular
	### card so that you can "configure" Xwindows after installation
	### Xconfigurator gets it wrong %50 of the time for my cards
xconfig --server XF86_VGA16
	#### Give it a dumb root password 
rootpw MyPassword
	#### Tell it to use shadow passwording
auth --useshadow
	### Tell it to install Lilo at the master boot record
lilo --location mbr

	### Now let us install packages, is there a simple command for all?
%packages

	### Select the packages to install, I think this is all of them
        ### Unlike the installation program which only installs one X Server,
	### my options installs all of them in case you switch video cards,
	### which I do a lot. 	
@ Base
@ Printer Support
@ X Window System
@ GNOME
@ KDE
@ Mail/WWW/News Tools
@ DOS/Windows Connectivity
@ File Managers
@ Graphics Manipulation
@ Console Games
@ X Games
@ Console Multimedia
@ X multimedia support
@ Networked Workstation
@ Dialup Workstation
@ News Server
@ NFS Server
@ SMB (Samba) Connectivity
@ IPX/Netware(tm) Connectivity
@ Anonymous FTP Server
@ Web Server
@ DNS Name Server
@ Postgres (SQL) Server
@ Network Management Workstation
@ TeX Document Formatting
@ Emacs
@ Emacs with X windows
@ C Development
@ Development Libraries
@ C++ Development
@ X Development
@ GNOME Development
@ Kernel Development
@ Extra Documentation
AfterStep
AfterStep-APPS
AnotherLevel
ElectricFence
GXedit
ImageMagick
ImageMagick-devel
MAKEDEV
ORBit
ORBit-devel
SVGATextMode
SysVinit
WindowMaker
X11R6-contrib
XFree86-100dpi-fonts
XFree86
XFree86-3DLabs
XFree86-75dpi-fonts
XFree86-8514
XFree86-AGX
XFree86-FBDev
XFree86-I128
XFree86-ISO8859-2
XFree86-ISO8859-2-100dpi-fonts
XFree86-ISO8859-2-75dpi-fonts
XFree86-ISO8859-2-Type1-fonts
XFree86-ISO8859-9-100dpi-fonts
XFree86-ISO8859-9
XFree86-ISO8859-9-75dpi-fonts
XFree86-Mach32
XFree86-Mach64
XFree86-Mach8
XFree86-Mono
XFree86-P9000
XFree86-S3
XFree86-S3V
XFree86-SVGA
XFree86-VGA16
XFree86-W32
XFree86-XF86Setup
XFree86-Xnest
XFree86-Xvfb
XFree86-cyrillic-fonts
XFree86-devel
XFree86-doc
XFree86-libs
XFree86-xfs
Xaw3d
Xaw3d-devel
Xconfigurator
adjtimex
aktion
am-utils
anonftp
apache
apache-devel
apmd
arpwatch
ash
at
audiofile
audiofile-devel
aumix
authconfig
autoconf
autofs
automake
awesfx
basesystem
bash
bash2
bash2-doc
bc
bdflush
bin86
bind
bind-devel
bind-utils
binutils
bison
blt
bootparamd
byacc
bzip2
caching-nameserver
cdecl
cdp
chkconfig
chkfontpath
cleanfeed
comanche
compat-binutils
compat-egcs
compat-egcs-c++
compat-egcs-g77
compat-egcs-objc
compat-glibc
compat-libs
comsat
console-tools
control-center
control-center-devel
control-panel
cpio
cpp
cproto
cracklib
cracklib-dicts
crontabs
ctags
cvs
cxhextris
desktop-backgrounds
dev
dhcp
dhcpcd
dialog
diffstat
diffutils
dip
dosemu
dosemu-freedos
dump
e2fsprogs
e2fsprogs-devel
ed
ee
efax
egcs
egcs-c++
egcs-g77
egcs-objc
eject
elm
emacs
emacs-X11
emacs-el
emacs-leim
emacs-nox
enlightenment
enlightenment-conf
enscript
esound
esound-devel
etcskel
exmh
expect
ext2ed
faces
faces-devel
faces-xface
faq
fbset
fetchmail
fetchmailconf
file
filesystem
fileutils
findutils
finger
flex
fnlib
fnlib-devel
fortune-mod
freetype
freetype-devel
ftp
fvwm
fvwm2
fvwm2-icons
fwhois
gated
gawk
gd
gd-devel
gdb
gdbm
gdbm-devel
gdm
gedit
gedit-devel
genromfs
gettext
getty_ps
gftp
ghostscript
ghostscript-fonts
giftrans
gimp
gimp-data-extras
gimp-devel
gimp-libgimp
gimp-manual
git
glib
glib-devel
glib10
glibc
glibc-devel
glibc-profile
gmc
gmp
gmp-devel
gnome-audio
gnome-audio-extra
gnome-core
gnome-core-devel
gnome-games
gnome-games-devel
gnome-libs
gnome-libs-devel
gnome-linuxconf
gnome-media
gnome-objc
gnome-objc-devel
gnome-pim
gnome-pim-devel
gnome-users-guide
gnome-utils
gnorpm
gnotepad+
gnuchess
gnumeric
gnuplot
gperf
gpm
gpm-devel
gqview
grep
groff
groff-gxditview
gsl
gtk+
gtk+-devel
gtk+10
gtk-engines
gtop
guavac
guile
guile-devel
gv
gzip
gzip
hdparm
helptool
howto
howto-chinese
howto-croatian
howto-french
howto-german
howto-greek
howto-html
howto-indonesian
howto-italian
howto-japanese
howto-korean
howto-polish
howto-serbian
howto-sgml
howto-slovenian
howto-spanish
howto-swedish
howto-turkish
ical
imap
imlib
imlib-cfgeditor
imlib-devel
indent
indexhtml
inews
info
initscripts
inn
inn-devel
install-guide
intimed
ipchains
ipxutils
ircii
isapnptools
isicom
ispell
itcl
jed
jed-common
jed-xjed
joe
kaffe
kbdconfig
kdeadmin
kdebase
kdegames
kdegraphics
kdelibs
kdemultimedia
kdenetwork
kdesupport
kdeutils
kernel
kernel
kernel
kernel-BOOT
kernel-doc
kernel-headers
kernel-ibcs
kernel-pcmcia-cs
kernel-smp
kernel-smp
kernel-smp
kernel-source
kernelcfg
knfsd
knfsd-clients
korganizer
kpilot
kpppload
kterm
ld.so
ldconfig
less
lha
libPropList
libc
libelf
libghttp
libghttp-devel
libgr
libgr-devel
libgr-progs
libgtop
libgtop-devel
libgtop-examples
libjpeg
libjpeg-devel
libjpeg6a
libpcap
libpng
libpng-devel
libstdc++
libtermcap
libtermcap-devel
libtiff
libtiff-devel
libtool
libungif
libungif-devel
libungif-progs
libxml
libxml-devel
lilo
linuxconf
linuxconf-devel
logrotate
losetup
lout
lout-doc
lpg
lpr
lrzsz
lslk
lsof
ltrace
lynx
m4
macutils
mailcap
mailx
make
man
man-pages
mars-nwe
mawk
mc
mcserv
metamail
mgetty
mgetty-sendfax
mgetty-viewfax
mgetty-voice
mikmod
mingetty
minicom
mkbootdisk
mkdosfs-ygg
mkinitrd
mkisofs
mkkickstart
mktemp
mkxauth
mod_perl
mod_php
mod_php3
modemtool
modutils
mount
mouseconfig
mpage
mpg123
mt-st
mtools
multimedia
mutt
mxp
nag
nc
ncftp
ncompress
ncpfs
ncurses
ncurses-devel
ncurses3
net-tools
netcfg
netkit-base
netscape-common
netscape-communicator
netscape-navigator
newt
newt-devel
nmh
nscd
ntsysv
open
p2c
p2c-devel
pam
passwd
patch
pciutils
pdksh
perl
perl-MD5
pidentd
pilot-link
pilot-link-devel
pine
playmidi
playmidi-X11
pmake
pmake-customs
popt
portmap
postgresql
postgresql-clients
postgresql-devel
ppp
printtool
procinfo
procmail
procps
procps-X11
psacct
psmisc
pump
pwdb
pygnome
pygtk
python
python-devel
python-docs
pythonlib
qt
qt-devel
quota
raidtools
rcs
rdate
rdist
readline
readline-devel
redhat-logos
redhat-release
rgrep
rhl-alpha-install-addend-en
rhl-getting-started-guide-en
rhl-install-guide-en
rhmask
rhs-hwdiag
rhs-printfilters
rhsound
rmt
rootfiles
routed
rpm
rpm-devel
rsh
rsync
rusers
rwall
rwho
rxvt
sag
samba
sash
screen
sed
sendmail
sendmail-cf
sendmail-doc
setconsole
setserial
setup
setuptool
sgml-tools
sh-utils
shadow-utils
shapecfg
sharutils
slang
slang-devel
sliplogin
slocate
slrn
slrn-pull
sndconfig
sox
sox-devel
specspo
squid
stat
statserial
strace
svgalib
svgalib-devel
swatch
switchdesk
switchdesk-gnome
switchdesk-kde
symlinks
sysklogd
talk
taper
tar
tcl
tclx
tcp_wrappers
tcpdump
tcsh
telnet
termcap
tetex
tetex-afm
tetex-doc
tetex-dvilj
tetex-dvips
tetex-latex
tetex-xdvi
texinfo
textutils
tftp
time
timeconfig
timed
timetool
tin
tix
tk
tkinter
tksysv
tmpwatch
traceroute
transfig
tree
trn
trojka
tunelp
ucd-snmp
ucd-snmp-devel
ucd-snmp-utils
umb-scheme
unarj
units
unzip
urlview
urw-fonts
usermode
usernet
utempter
util-linux
uucp
vim-X11
vim-common
vim-enhanced
vim-minimal
vixie-cron
vlock
w3c-libwww
w3c-libwww-apps
w3c-libwww-devel
wget
which
wmakerconf
wmconfig
words
wu-ftpd
x11amp
x11amp-devel
x3270
xanim
xbanner
xbill
xboard
xboing
xchat
xcpustate
xdaliclock
xdosemu
xearth
xfig
xfishtank
xfm
xgammon
xinitrc
xjewel
xlispstat
xloadimage
xlockmore
xmailbox
xmorph
xntp3
xosview
xpaint
xpat2
xpdf
xpilot
xpm
xpm-devel
xpuzzles
xrn
xscreensaver
xsysinfo
xtoolwait
xtrojka
xwpick
xxgdb
yp-tools
ypbind
ypserv
ytalk
zgv
zip
zlib
zlib-devel
zsh
	### Anything after %post gets interpreted as a post install command
	### and will be chrooted to the mount point of "/" for the
	### new installation 
%post 

# add another nameserver
echo "nameserver 10.0.1.10" >> /etc/resolv.conf
echo "10.0.1.10		server.local	server" >> /etc/resolv.conf


Conclusion -- it is good

I think the RedHat Kickstart stuff is good. I never did find out if the other distributions have it, didn't have enough time. Oh well. It still needs a lot of work to make it a really cool way of doing installations. The problem is, instead of just bitching about it, if it needs work, and you like it, contribute to the cause and help develop kickstart for RedHat or for any other Linux distribution. I wrote this article, now, you help out and contact the RedHat folks or other people to make the process even more cool!

Overall, I give Kickstart method a "B" for 6.0, and a "C" for the 5.2 version. It is cool compared to the corrupted commercial alternative which forces you to reboot 10 times before it is done installing. The potential for Linux is amazing compared to commercial closed sourced alternatives. When software is written not because of profit but because it is cool and/or because people want it done right, the long term potential far outweighs the short-term profit-minded mentality of people who cannot write good software or who just want things done "just to get it to work". Kickstart has the potential to reduce the overall cost of consulting and the time it takes to install Linux systems on a mass scale (which benefits the novice and expert computer consultant). It is funny to watch commercial companies who are trying to emulate what Linux and other UNIX systems can do. I see commercial products out there which attempt to do mass installations for closed sourced corrupted operating systems and I laugh at all the hard work they have to do. I want to stress something, this method I have shown today is not the easiest method to install Linux. I will explain this in another article someday. It will make any commercial or closed sourced operating system look like garbage compared to Linux.


My perl script

I used this perl script to extract a list of rpms from the /RedHat/RPMS directory on the cdrom. I only had about 6 corrections to make and figured it would take me longer to fix the perl script that it would be to fix the list. There has to be a simpler way of getting the list with exact results, but often it is just a decision between what you know works, and taking the time to figure out a better way. It only took me 5 minutes to write this script. Most of the time wasted was booting off of the kickstart disk to see how many errors I got.
#!/usr/bin/perl

my @RPMS = </home/ftp/RedHat60/RedHat/RPMS/*.rpm>;
my $Dest = "/tmp/List_2.txt";

open(FILE,">$Dest");

foreach $Rpm (@RPMS)
  {
    ## Would be easier if I had used ? instead of /
  $Rpm =~ s/\/home\/ftp\/RedHat60\/RedHat\/RPMS\///;

  if ($Rpm =~ /\-[0-9]+\-[0-9]+\./) 
    {($Rpm,$Junk) = split(/\-[0-9]+\-[0-9]\./, $Rpm,2);}
  elsif ($Rpm =~ /\-[0-9]+\./) 
    {($Rpm,$Junk) = split(/\-[0-9]+\./, $Rpm,2);}
  else {($Rpm,$Junk) = split(/\-[0-9]/, $Rpm,2);}

  print FILE "$Rpm\n";
  }

Mark works as JALG hardware assistant (shorts and tee-shirt) under Mike Hunter at The Computer Underground and as a professional (suit and tie) consultant at 800linux.com. In his spare time, he does volunteer stuff, like writing these documents.


Copyright © 1999, Mark Nielsen
Published in Issue 43 of Linux Gazette, July 1999


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next